8000 MAINT: Remove Python <= 3.4 logic and imports by mwtoews · Pull Request #13852 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: Remove Python <= 3.4 logic and imports #13852

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

Closed
wants to merge 1 commit into from

Conversation

mwtoews
Copy link
Contributor
@mwtoews mwtoews commented Jun 27, 2019

This PR aims to remove and simplify Python code that was intended for Python 2 and Python <= 3.4, which are no longer supported.

The focus here is primarily around if sys.version_info[0] >= 3 blocks, but also removes unnecessary ImportErrors for modules that are part of the Python >=3.5 standard library. Some comments regarding compatibility are retained, but not all.

Careful reviews and comments are most appreciated!

@charris
Copy link
Member
charris commented Jun 27, 2019

We probably won't merge this right away in order to keep code differences with 1.17 to a minimum until it settles down.

@mwtoews
Copy link
Contributor Author
mwtoews commented Jun 27, 2019

Ah, I suspected this could have been the case. I can revise and merge this PR with HEAD when the time comes.

@charris
Copy link
Member
charris commented Jun 27, 2019

The test failures are legitimate.

@mwtoews
Copy link
Contributor Author
mwtoews commented Jun 28, 2019

All tests now pass (except for Shippable -- no idea why). A few too many import sys blocks were removed on false recommendation by PyCharm. I've manually re-checked these removals to see if sys was used elsewhere in the files. And I've now removed test_intp.

@tylerjereddy
Copy link
Contributor

I restarted the Shippable job for you

@mwtoews
Copy link
Contributor Author
mwtoews commented Jul 1, 2019

All tests now pass. While I'm holding back putting too many changes in one PR, other related modifications include:

  • Remove a few six dependencies
  • Update a few xrange to just range
  • Use the exec function the normal Python 3 way

@charris
Copy link
Member
charris commented Jan 2, 2020

@mwtoews Time to get started. I would recommend breaking this up into smaller chunks for easier review. That could either be by task -- remove from __future__ import ... or possibly by module. Care needs to be taken with py3k.py not to remove any functions so as not to break downstream code, I couldn't tell if that was good in a quick scan. Things like u"hello world" I think we can leave for the time being as it is valid Python3.

@mwtoews
Copy link
Contributor Author
mwtoews commented Jan 6, 2020

@charris agree with the strategy to break this into a few commits (based on type of modification), and to try to avoid removing module functions potentially imported downstream.

@charris
Copy link
Member
charris commented Jan 6, 2020

@mwtoews folks have been going wild on the cleanup, so this PR is probably out of date.

@seberg
Copy link
Member
seberg commented Jan 17, 2020

There are likely still a few very good things in here, unfortunately big chunks of this are already done or being finished e.g. in gh-15335. May be interesting to get some of the cleanups out of here, but if not, this is probably soon simply outdated. (ping @sethtroisi, just in case)

@seberg seberg added the 57 - Close? Issues which may be closable unless discussion continued label Jan 17, 2020
@mwtoews
Copy link
Contributor Author
mwtoews commented Jan 17, 2020

I'll take a look and pick-up remaining edits. I might just push -f on this PR, but I'll decide when I have a better look.

@seberg seberg removed the 57 - Close? Issues which may be closable unless discussion continued label Jan 17, 2020
@mwtoews
Copy link
Contributor Author
mwtoews commented Jan 21, 2020

This PR is now mostly superseded by various other PRs.

@mwtoews mwtoews closed this Jan 21, 2020
@sethtroisi
Copy link
Contributor

I'm pulling all the remaining parts out of this into a new PR

@mwtoews mwtoews deleted the unpy2 branch March 9, 2021 10:30
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.

5 participants
0