Skip to content

python: add version() to get running version - #1322

Merged
kngwyu merged 1 commit into
PyO3:masterfrom
davidhewitt:py-version
Dec 20, 2020
Merged

python: add version() to get running version#1322
kngwyu merged 1 commit into
PyO3:masterfrom
davidhewitt:py-version

Conversation

@davidhewitt

Copy link
Copy Markdown
Member

This PR adds a new API Python::version() which is a safe convenience wrapper around Py_GetVersion().

Now that we offer abi3 wheels which may need to support multiple different Python versions, such an API will come in helpful. We saw this already in #1320.

@davidhewitt

Copy link
Copy Markdown
Member Author

PyPy failure is upstream bug in setup-python, but we might not want to merge this until this is resolved as I'd like to know that this API works correctly with PyPy.

@kngwyu kngwyu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment thread src/python.rs Outdated
Comment thread src/python.rs Outdated
Comment thread src/python.rs Outdated
@davidhewitt

Copy link
Copy Markdown
Member Author

Thanks for the review, I pushed some changes to address.

Also I renamed this API to PythonVersionInfo and Python::version_info(), and also added Python::version() -> &'static str. This matches better with sys.version_info and sys.version.

Comment thread src/python.rs Outdated
@davidhewitt

Copy link
Copy Markdown
Member Author

Thanks, simplified partial_cmp implementations and force-pushed.

Comment thread src/python.rs
@alex alex mentioned this pull request Dec 19, 2020
Comment thread src/python.rs Outdated
@kngwyu

kngwyu commented Dec 20, 2020

Copy link
Copy Markdown
Member

Thanks!

@kngwyu
kngwyu merged commit 3595a05 into PyO3:master Dec 20, 2020
@davidhewitt
davidhewitt deleted the py-version branch August 10, 2021 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants