-
-
Notifications
You must be signed in to change notification settings - Fork 11k
BUILD: clean out py2 stuff from npy_3kcompat.h #26842
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
/* | ||
* This is a renamed copy of the Python non-limited API function _PyLong_AsInt. It is | ||
* included here because it is missing from the PyPy API. It completes the PyLong_As* | ||
* group of functions and can be useful in replacing PyInt_Check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyPy has this function from 7.3.13 released about a year ago
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hehe, and now CPython removed it
@@ -4702,7 +4702,7 @@ setup_scalartypes(PyObject *NPY_UNUSED(dict)) | |||
DUAL_INHERIT(CDouble, Complex, ComplexFloating); | |||
SINGLE_INHERIT(CLongDouble, ComplexFloating); | |||
|
|||
DUAL_INHERIT2(String, String, Character); | |||
DUAL_INHERIT2(String, Bytes, Character); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subtle: this creates a base type inheritance on PyBytesType
. The replacement was done previously via #define PyString_Type PyBytes_Type
I started looking at #12324, but got distracted by all the cruft in this file. |
dfa6beb
to
18170ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, since we don't need it. Some downstream projects will probably notice, but it should be easy enough to adapt or vendor the functions.
So giving others a chance to have a look maybe, but I think this can go in.
|
||
/* This is a copy of _PyErr_ChainExceptions | ||
/* This is a copy of _PyErr_ChainExceptions, which | ||
* is no longer exported from Python3.12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this is now _PyErr_ChainExceptions1
, but a different thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I also noticed all this cruft when I vendored the pythoncapi-compat header but didn't have the fortitude to clean it up. Appreciate you taking the time!
If you're reading this because it turns out merging this PR breaks your build for some reason and you don't immediately see how to deal with it (e.g. vendor an old copy of the header), please do let us know in an issue. |
#include "numpy/ndarrayobject.h" but add it where it was missing in
numpy/_core/src/multiarray/array_method.c`I will add a release note once I get a PR number