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
There was a problem hiding this comment.
This might look better up top with the similar compatibility hacks.
There was a problem hiding this comment.
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 <[email protected]>
0b7907d to
77c2c23
Compare
|
Thanks Thomas. |
This includes a fix for Python 3.10: numpy/numpy#16417 Signed-off-by: Akihiko Odaki <[email protected]>
In python/cpython#20290 CPython changed
Py_TYPEfrom a macro to an inline function. This requires a codechange to us
Py_SET_TYPEinstead when usingPy_TYPE()as a lvaluein c code.
This is a draft (and I expect it to fail all of the tests) becausePy_SET_TYPEwas 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 ;) )