Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Merged
merged 1 commit into from
Dec 20, 2020

Conversation

davidhewitt
Copy link
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
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.

Copy link
Member

@kngwyu kngwyu left a comment

Choose a reason for hiding this comment

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

Thanks!

@davidhewitt
Copy link
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.

@davidhewitt
Copy link
Member Author

Thanks, simplified partial_cmp implementations and force-pushed.

@alex alex mentioned this pull request Dec 19, 2020
@kngwyu
Copy link
Member

kngwyu commented Dec 20, 2020

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants