Skip to content

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

Merged
merged 1 commit into from
Jan 4, 2020

Conversation

sethtroisi
Copy link
Contributor

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

Copy link
Member

@eric-wieser eric-wieser left a 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

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.

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
Copy link
Member

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.

Copy link
Contributor Author

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)

Copy link
Contributor Author

@sethtroisi sethtroisi left a 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.

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
Copy link
Contributor Author

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)

@sethtroisi sethtroisi changed the title Cleaning up PY_MAJOR_VERSION/PY_VERSION_HEX DEP: Cleaning up PY_MAJOR_VERSION/PY_VERSION_HEX Jan 3, 2020
@eric-wieser eric-wieser changed the title DEP: Cleaning up PY_MAJOR_VERSION/PY_VERSION_HEX MAINT: Cleaning up PY_MAJOR_VERSION/PY_VERSION_HEX Jan 3, 2020
@sethtroisi
Copy link
Contributor Author

I think this can be pulled. (I don't want to sound pushy, I'm just excited to build the other PRs off this)

@mattip
Copy link
Member

mattip commented Jan 4, 2020

One of these PRs should add a release note

@mattip mattip merged commit c1f1bc9 into numpy:master Jan 4, 2020
@mattip
Copy link
Member

mattip commented Jan 4, 2020

Thanks @sethtroisi

@sethtroisi sethtroisi deleted the remove_python3_part3 branch January 4, 2020 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants