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

Fix build with Python 3.13+ #368

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

hroncok
Copy link

@hroncok hroncok commented Sep 4, 2024

Avoid using PyObject_AsReadBuffer, do what PyObject_AsReadBuffer does.

Note that this is not safe, and it has never been safe, but the code does exactly what it used to do (at least on Python 3.8+).

Fixes #362

Avoid using PyObject_AsReadBuffer, do what PyObject_AsReadBuffer does.

Note that this is not safe, and it has never been safe,
but the code does *exactly* what it used to do (at least on Python 3.8+).

Fixes jnwatson#362

Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
@kloczek
Copy link

kloczek commented Sep 12, 2024

Please do not use

#if PY_VERSION_HEX < 0x030d0000
   .
   .
#else
   .
   .
#endif

Because this makes that code not pyupgradeable.
Please use

if sys.version_info < (3, 13):
   .
   .
else:
   .
   .

This would allow in the future drop first part of the code on use pyupgrade --py313.
Or if you want to use that please first submit to pyupgrade PR which would allow recognise code like in your PR.

@hroncok
Copy link
Author

hroncok commented Sep 12, 2024

Tomasz, this is C. Feel free to submit an alternate PR, but I won't try to figure out how to make changes in C pyupgradeable.

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.

Fails to build with Python 3.13 due to removal of PyObject_AsReadBuffer
3 participants