TST: add tests for stable ABI numpy extensions - #31822
Conversation
|
Seems like gcc 9 which is used in the failing old_gcc CI does not support taking address of opaque pointer while de-referencing it. In Limited C-API rror: dereferencing pointer to incomplete type ‘PyTypeObject’ {aka ‘struct _typeobject’}
1156 | #define PyTimedeltaArrType_Type (*(PyTypeObject *)PyArray_API[216])
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/hostedtoolcache/Python/3.12.13/x64/include/python3.12/object.h:384:80: note: in definition of macro ‘PyObject_TypeCheck’
384 | # define PyObject_TypeCheck(ob, type) PyObject_TypeCheck(_PyObject_CAST(ob), (type))
| ^~~~
limited_api_cython_3_9_npy2_0.abi3.so.p/limited_api_cython.pyx.c:5078:47: note: in expansion of macro ‘PyTimedeltaArrType_Type’
5078 | __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
| ^~~~~~~~~~~~~~~~~~~~~~~ |
Co-authored-by: da-woods <dw-git@d-woods.co.uk>
|
We talked about this at the community meeting and no one objected to dropping gcc9 from the CI matrix. I'm going to put in a PR to do that. |
ngoldbaum
left a comment
There was a problem hiding this comment.
Overall looks pretty good. I left some comments inline.
Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
|
I think if you rebase on or merge with main the error will go away because #31843 is merged. |
ngoldbaum
left a comment
There was a problem hiding this comment.
I did one more review pass and caught a couple minor issues and one suggestion about testing without NPY_TARGET_VERSION that I missed on the last pass. Otherwise I think this looks great so I'm approving. Please go ahead and merge this once you've addressed this last round of comments.
Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
|
Missed the cython version check in |
|
See #31875. |
Co-authored-by: da-woods <dw-git@d-woods.co.uk> Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
Co-authored-by: da-woods <dw-git@d-woods.co.uk> Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
TST: add tests for stable ABI numpy extensions (#31822)
PR summary
This PR adds tests for stable ABI extensions compiled with numpy C-API as well as cython API.
limited_api.cis used as a template and parameterized byMODULE_NAMEfor every combination of Python abi3 version and NumPy target version. Same is done forlimited_api_cythonwhere cython extension is tested against every combination of Python abi3 version and NumPy target version. I've expanded tests to cover the datetime APIs which was broken recently to avoid such future breakages.The failing MSVC test on x86 is because of #31762 which is now detected as a failure.
AI Disclosure
I used Claude to work on this.