-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Opening an issue in cython due to a discussion in NumPy.
The currently ValueError when the size of a struct changed (i.e. shrank), is pretty confusing for users. In the case of NumPy we added (basically private) fields to the end of the ndarray
struct. This is perfectly ABI compatible so long there are no subclasses involved. (Subclassing ndarray
in cython does not work at all, so nobody is doing it.)
Some projects incorrectly compile against a newer NumPy versions and release older wheels: For them, this is annoying to track down, but I think they are happy to learn. But it seems even some end-users run into it occsionally (since they write their own cython modules).
For NumPy, a solution would be if we could call import_array()
before the size check, since I believe that already raises the error correctly (assuming we bump the C-API feature version).
In general, I am not sure what best to do. Maybe just adding additional information saying that typically you should compile using the oldest support version? Or maybe we could add some special feature to end a class definition with a __variable_private__
so that cython can decide to only complain if someone actually subclasses that specific class?