-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
MAINT: Cleaning up PY_MAJOR_VERSION/PY_VERSION_HEX #15232
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
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.
Looks good on a first pass, will let a second reviewer confirm
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.
All changes here look good to me as well. Note that we have #if PY_VERSION_HEX < 0x03030000
and #if PY_VERSION_HEX >= 0x03050000
which also apply to 1.16+ (and 1.17). So that we can remove those just as well. (and one PY_VERSION_HEX < 0x03040400
).
I am fine with moving that to a new PR though if you prefer.
@@ -13,11 +13,9 @@ | |||
#include <Python.h> | |||
#include <stdio.h> | |||
|
|||
#if PY_VERSION_HEX >= 0x03000000 | |||
#ifndef NPY_PY3K | |||
#define NPY_PY3K 1 |
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.
I removing the internal use of this is one of the next steps.
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.
Yes, I'm also working on cleaning that up (in another CL)
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.
All changes here look good to me as well. Note that we have
#if PY_VERSION_HEX < 0x03030000
and#if PY_VERSION_HEX >= 0x03050000
which also apply to 1.16+ (and 1.17). So that we can remove those just as well. (and onePY_VERSION_HEX < 0x03040400
).I am fine with moving that to a new PR though if you prefer.
I'm doing those in a separate CL as you have to inspect and process the logic while this is just verify matching #if #endif
@@ -13,11 +13,9 @@ | |||
#include <Python.h> | |||
#include <stdio.h> | |||
|
|||
#if PY_VERSION_HEX >= 0x03000000 | |||
#ifndef NPY_PY3K | |||
#define NPY_PY3K 1 |
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.
Yes, I'm also working on cleaning that up (in another CL)
I think this can be pulled. (I don't want to sound pushy, I'm just excited to build the other PRs off this) |
One of these PRs should add a release note |
Thanks @sethtroisi |
Remove most of PY_MAJOR_VERSION guards that are no longer needed (after Python2 support is dropped)
There are a handful more of these that are more difficult (e.g. this or this) that will be handled in a 2nd pass