-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Segfault when registering gufunc with signature "()->(4)" in C (with numpy 1.15) #14949
Comments
The ability to specify gufunc signatures with fixed-size dimensions was added in NumPy 1.16: https://numpy.org/devdocs/release/1.16.0-notes.html#generalized-ufunc-signatures-now-allow-fixed-size-dimensions I don't think there is a simple way to work around this for older versions of NumPy, but maybe @mattip, @mvhk, or another developer involved with the implementation of NEP 20 will have a recommendation. |
Thanks for the answer! That at least explains our segfault ;) And from reading the description of the NEP, I might have spotted a workaround (emphasize mine):
So we can actually use From a quick test this seems to work (now compiled with
|
OK, closing this, as it seems solved for us. Thanks again for the pointer! |
@jorisvandenbossche, thanks for the update. Glad to hear you worked out a solution. |
In PyGEOS, we are writing (g)ufuncs in C, and are running into a problem with a generalized ufunc on older numpy versions: pygeos/pygeos#69
We are defining a generalized ufunc with a
()->(4)
signature. With numpy 1.17 this works fine, but with older numpy (tested 1.15 locally, and on travis also 1.13) it is failing.It doesn't fail when running, but already segfaults when registering the ufunc with that signature (to be more precise: it segfaults on importing the python package that on import loads the extension module that registers the ufuncs).
We are doing something like (the full diff can be seen in the issue linked above):
and there doesn't seem to be anything wrong with the inner functions and dtypes (
bounds_funcs
andbounds_dtypes
), because if I change the signature from"()->(4)"
to"()->()"
, it actually "works" (it no longer segfaults on registration, and it runs, only giving a wrong (partly) result).I know this is a rather vague issue description, and in addition only happens for older numpy (but still, as a dependent library, we would like to support a range of numpy versions). But:
"()->(4)"
? Or was this not a supported signature?The text was updated successfully, but these errors were encountered: