-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
MAINT: support python 3.10 #16417
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
MAINT: support python 3.10 #16417
Conversation
Ugh. Is it certain that this change will persist to release? |
Something like this in #if PY_VERSION_HEX < 0x030a0000
#define Py_SET_TYPE(obj, typ) (Py_TYPE(obj) = typ)
#endif |
This is part of a series of intentional API breaks to try and condense the python c-api so I am pretty confident that this will persist. |
It seems like we should also replace all |
We might want to make a compatibility include file to use until Python3.9 gets dropped. Probably need to use new names to avoid redefinitions. |
We are running tests against 3.9-dev, so that should validate that this works. |
In python/cpython#20290 CPython changed `Py_TYPE` from a macro to an inline function. This requires a code change to us `Py_SET_TYPE` instead when using `Py_TYPE()` as a lvalue in c code. In python/cpython#20429 CPython changed `Py_SIZE` from a macro to an inline function. This requires a code change to us `Py_SET_SIZE` instead of using `Py_SIZE` as a lvalue in c code.
To support the change to Py_SIZE and Py_TYPE the Py_SET_SIZE and Py_SET_TYPE macros are provided in py39. This provides the same macros falling back to the old method for < py39.
cf7a282
to
4bf06ad
Compare
@@ -546,4 +546,10 @@ NpyCapsule_Check(PyObject *ptr) | |||
} | |||
#endif | |||
|
|||
/* Introduced in https://github.com/python/cpython/commit/d2ec81a8c99796b51fb8c49b77a7fe369863226f */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might look better up top with the similar compatibility hacks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should also add a reference for the other one.
The testing error is on the azure end and may be ignored. |
6afdd10
to
0b7907d
Compare
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
0b7907d
to
77c2c23
Compare
Thanks Thomas. |
This includes a fix for Python 3.10: numpy/numpy#16417 Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
In python/cpython#20290 CPython changed
Py_TYPE
from a macro to an inline function. This requires a codechange to us
Py_SET_TYPE
instead when usingPy_TYPE()
as a lvaluein c code.
This is a draft (and I expect it to fail all of the tests) becausePy_SET_TYPE
was only introduced in py39. Can I please have some guidance on how to do version gating (or have someone who knows take over this PR ;) )