Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyo3-build-config: Use "m" ABI tag for libpython 3.7 by default #2288

Merged
merged 1 commit into from
Apr 9, 2022
Merged
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ PyO3 versions, please see the [migration guide](https://pyo3.rs/latest/migration
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed

- Default to "m" ABI tag when choosing `libpython` link name for CPython 3.7 on Unix. [#2288](https://github.com/PyO3/pyo3/pull/2288)

## [0.16.3] - 2022-04-05

### Packaging
Expand Down
19 changes: 16 additions & 3 deletions pyo3-build-config/src/impl_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,15 @@ fn default_lib_name_unix(
match implementation {
PythonImplementation::CPython => match ld_version {
Some(ld_version) => format!("python{}", ld_version),
None => format!("python{}.{}", version.major, version.minor),
None => {
if version > PythonVersion::PY37 {
// PEP 3149 ABI version tags are finally gone
format!("python{}.{}", version.major, version.minor)
} else {
// Work around https://bugs.python.org/issue36707
format!("python{}.{}m", version.major, version.minor)
}
}
},
PythonImplementation::PyPy => {
if version >= (PythonVersion { major: 3, minor: 9 }) {
Expand Down Expand Up @@ -2142,10 +2150,15 @@ mod tests {
#[test]
fn default_lib_name_unix() {
use PythonImplementation::*;
// Defaults to pythonX.Y for CPython
// Defaults to python3.7m for CPython 3.7
assert_eq!(
super::default_lib_name_unix(PythonVersion { major: 3, minor: 7 }, CPython, None),
"python3.7",
"python3.7m",
);
// Defaults to pythonX.Y for CPython 3.8+
assert_eq!(
super::default_lib_name_unix(PythonVersion { major: 3, minor: 8 }, CPython, None),
"python3.8",
);
assert_eq!(
super::default_lib_name_unix(PythonVersion { major: 3, minor: 9 }, CPython, None),
Expand Down