BUG: Fix build of third-party extensions with Py_LIMITED_API#20818
BUG: Fix build of third-party extensions with Py_LIMITED_API#20818seberg merged 3 commits intonumpy:mainfrom
Conversation
e495910 to
52b2da3
Compare
Work around a regression in Numpy 1.22.0 that broke building third party packages using the limited Python C API. See [numpy#20818](numpy/numpy#20818).
The type `vectorcallfunc` is not defined by Python's limited API. Guard its use with a `#ifdef` so that third-party extensions that use the Numpy C API will build with Py_LIMITED_API defined. This fixes a regression introduced in numpy#20315.
52b2da3 to
a61474e
Compare
seberg
left a comment
There was a problem hiding this comment.
Thanks, LGTM!
Not sure if we want to move the test somewhere else (I don't think it is run in CI?), but I do not mind if we don't get it. So it looks good as is, but maybe Matti has an idea for the test.
|
@lpsinger it looks good, however the debug tests are failing. I am not sure I understand why? I now realize that yes, this gets run as a test so that is all good, anyway, and I was just silly. But this extension must not be compiled if we are running in debug mode... Although, I am not clear why this many tests are failing. |
Understood. I'll split the example project into two projects so that we can build them in separate tests, and apply something like the skipif statement from https://github.com/numpy/numpy/blob/main/numpy/tests/test_public_api.py#L468-L475 to it. |
47f3b30 to
1edd640
Compare
Note, I found that on my Mac, |
|
OK, the debug build is passing now. |
|
This looks great, and the test will help keep regressions from creeping in. A couple of nits:
|
I don't think so. The old cython test that I adapted this from wasn't marked as slow. In any case, that could be a separate PR.
Oh, very slick. I'll try that. |
Unfortunately, |
|
Lets put it in than, thanks! |
Numpy 1.22.0 had a regression that prevented building packages against the Python limited C API, that was fixed in Numpy 1.22.2. See numpy/numpy#20818.
Numpy 1.22.0 had a regression that prevented building packages against the Python limited C API, that was fixed in Numpy 1.22.2. See numpy/numpy#20818. Co-authored-by: Ralf Gommers <ralf.gommers@gmail.com>
This is a follow up to scipy#58. The Numpy regression fixed in numpy/numpy#20818 was introduced in Numpy 1.21.0, not 1.22.0. My mistake. Sorry!
Fixes #13784.
This PR consists of two commits: