Skip to content

Conversation

mattip
Copy link
Member

@mattip mattip commented Jul 3, 2024

  • Remove extraneous documentation page that was not linked in
  • Remove all the py2 compat defines and unused functions
  • Remove now unneeded #include "numpy/ndarrayobject.h" but add it where it was missing in numpy/_core/src/multiarray/array_method.c`
  • Fix up some uses of py2-isms

I will add a release note once I get a PR number

@mattip mattip added the 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes label Jul 3, 2024
/*
* 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.
Copy link
Member Author

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

Copy link
Member Author

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);
Copy link
Member Author

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

@mattip mattip added 03 - Maintenance 36 - Build Build related PR and removed 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes labels Jul 3, 2024
@mattip
Copy link
Member Author

mattip commented Jul 3, 2024

I started looking at #12324, but got distracted by all the cruft in this file.

@mattip mattip force-pushed the npy3k-cleanup branch 2 times, most recently from dfa6beb to 18170ef Compare July 3, 2024 14:09
Copy link
Member

@seberg seberg left a 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
Copy link
Member

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.

Copy link
Member

@ngoldbaum ngoldbaum left a 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!

@ngoldbaum ngoldbaum merged commit b46446e into numpy:main Jul 4, 2024
@ngoldbaum
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants