-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: Set deprecated fields to null in PyArray_InitArrFuncs #17319
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
Conversation
Initializing the deprecated fields to null ensures that if a user sets them to their own function pointers, this can be detected and the warning about using deprecated fields can be printed.
Thanks! Not sure if we can add an easy test, so I am happy to just put this is in as is. I wonder if we shouldn't just replace this whole code with @octachrome on a more general note, just asking anyone with custom dtypes: Can you share what you are doing with your custom dtypes so I could see if there is anything trickier/special that goes beyond the typical |
True, a I can't share our C code because it is a commercial product, but there is some documentation about how we use NumPy here: https://www.fico.com/fico-xpress-optimization/docs/dms2020-03/solver/optimizer/python/HTML/chNumpy.html Our product is an optimization framework in which users define large models consisting of variables and constraints on those variables. The product finds optimal assignments of the variables which satisfy the constraints. It is convenient for our users to use NumPy when defining their models, for example they can define large numbers of constraints in a single inequality expression, where both the left- and right-hand sides are vectors: There are several examples of how our users might use NumPy in this list: https://www.fico.com/fico-xpress-optimization/docs/dms2020-03/examples/python/GUID-E77AC35C-9488-3F0A-98B4-7F5FD81AFF1D.html |
Thanks, that is valuable information. I can't tell from the help whether or not there are potential issues going forward, I doubt it, but I am not sure. There are very few examples of user-dtypes (e.g. rational, quaternion) and only with small breaks such as here I hear of some more but can't closely look at. As a heads up: 1.20 will have more changes. Hopefully, you will just not notice it, but with large enough changes we have to expect potential issues (and since I don't know the details of your dtype I cannot be quite sure that serious ones are impossible). So if you can, please keep an eye out for the next release especially. If you have the man-power going as far as testing against NumPy master occasionally, which is available at: https://anaconda.org/scipy-wheels-nightly/numpy could be extremely helpful both for us and your users. |
OK, lets put this in, I might clean it up later (but this function will hopefully never change, until it gets deleted in some years...) @octachrome I noticed that I can try around a bit with the community edition. There is one thing that slightly worries me, but right now I still think its probably harmless. |
OK, one more issue already. You use a structured dtype with a single object field. I guess that is not an unreasonable, hack to make a typed object dtype. Master currently rejects that, so I have to allow that specifically. I guess it should all be fine, it seems like a very useful current hack (I will be surprised if there are not weird corner cases, but that is another issue). |
Thanks for taking the time to check our extension, that's greatly appreciated. I will pass on your comments to the lead dev who knows a lot more about it than I do. |
Thanks, current master has problems with There is another issue that I am changing the NumPy dtypes a lot (hopefully gentle enough), but one step is that each That should be easy to fix up, but it probably means that users will have to update |
Fixes gh-17318.
Initializing the deprecated fields to null ensures that if a user sets them to their own function pointers, this can be detected and the warning about using deprecated fields can be printed.