Skip to content

Commit

Permalink
support python3-dll-a free-threaded generatiton
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Nov 29, 2024
1 parent 82ab509 commit 2d524fe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pyo3-build-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ rust-version = "1.63"

[dependencies]
once_cell = "1"
python3-dll-a = { version = "0.2.6", optional = true }
python3-dll-a = { git = "https://github.com/pyo3/python3-dll-a", branch = "python-313t", optional = true }
target-lexicon = "0.12.14"

[build-dependencies]
python3-dll-a = { version = "0.2.6", optional = true }
python3-dll-a = { git = "https://github.com/pyo3/python3-dll-a", branch = "python-313t", optional = true }
target-lexicon = "0.12.14"

[features]
Expand Down
15 changes: 13 additions & 2 deletions pyo3-build-config/src/impl_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,17 @@ print("gil_disabled", get_config_var("Py_GIL_DISABLED"))
if self.lib_dir.is_none() {
let target = target_triple_from_env();
let py_version = if self.abi3 { None } else { Some(self.version) };
self.lib_dir =
import_lib::generate_import_lib(&target, self.implementation, py_version)?;
let abiflags = if self.is_free_threaded() {
Some("t")
} else {
None
};
self.lib_dir = import_lib::generate_import_lib(
&target,
self.implementation,
py_version,
abiflags,
)?;
}
Ok(())
}
Expand Down Expand Up @@ -1521,6 +1530,7 @@ fn default_cross_compile(cross_compile_config: &CrossCompileConfig) -> Result<In
.implementation
.unwrap_or(PythonImplementation::CPython),
py_version,
None,
)?;
}

Expand Down Expand Up @@ -1889,6 +1899,7 @@ pub fn make_interpreter_config() -> Result<InterpreterConfig> {
&host,
interpreter_config.implementation,
py_version,
None,
)?;
}

Expand Down
2 changes: 2 additions & 0 deletions pyo3-build-config/src/import_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub(super) fn generate_import_lib(
target: &Triple,
py_impl: PythonImplementation,
py_version: Option<PythonVersion>,
abiflags: Option<&str>,
) -> Result<Option<String>> {
if target.operating_system != OperatingSystem::Windows {
return Ok(None);
Expand Down Expand Up @@ -50,6 +51,7 @@ pub(super) fn generate_import_lib(
ImportLibraryGenerator::new(&arch, &env)
.version(py_version.map(|v| (v.major, v.minor)))
.implementation(implementation)
.abi_tag(abiflags)
.generate(&out_lib_dir)
.context("failed to generate python3.dll import library")?;

Expand Down

0 comments on commit 2d524fe

Please sign in to comment.