Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Modules/cpython-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ fn main() {
.expect("expected Modules/cpython-sys to live under the source tree");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
let builddir = env::var("PYTHON_BUILD_DIR").ok();
if gil_disabled(&srcdir, builddir.as_deref()) {
if gil_disabled(srcdir, builddir.as_deref()) {
println!("cargo:rustc-cfg=py_gil_disabled");
}
generate_c_api_bindings(srcdir, builddir.as_deref(), &out_path.as_path());
generate_c_api_bindings(srcdir, builddir.as_deref(), out_path.as_path());
// TODO(emmatyping): generate bindings to the internal parser API
// The parser includes things slightly differently, so we should generate
// it's bindings independently
Expand All @@ -27,11 +27,10 @@ fn gil_disabled(srcdir: &Path, builddir: Option<&str>) -> bool {
candidates.push(srcdir.to_path_buf());
for base in candidates {
let path = base.join("pyconfig.h");
if let Ok(contents) = std::fs::read_to_string(&path) {
if contents.contains("Py_GIL_DISABLED 1") {
if let Ok(contents) = std::fs::read_to_string(&path)
&& contents.contains("Py_GIL_DISABLED 1") {
return true;
}
}
}
false
}
Expand Down
1 change: 1 addition & 0 deletions Modules/cpython-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#![allow(non_snake_case)]
#![allow(unsafe_op_in_unsafe_fn)]
#![allow(unnecessary_transmutes)]
#![allow(clippy::approx_constant)]

use std::ffi::{c_char, c_int, c_void};

Expand Down
3 changes: 2 additions & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[toolchain]
channel = "1.91.1"
channel = "1.91.1"
components = ["clippy"]