Skip to content
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

Fix for Python 4: replace unsafe six.PY3 with PY2 #1959

merged 2 commits into from Jan 12, 2020


Copy link

@hugovk hugovk commented Jan 8, 2020

Summary of changes

We don't yet know if 3.10 or 4.0 will follow Python 3.9, but whichever it is, it will probably happen in 2020 when Python 3.9 reaches beta and work begins on Python 3.9+1.

There's some code which uses six.PY3:

if six.PY3:
    print("Python 3+ code")
    print "Python 2 code"


PY3 = sys.version_info[0] == 3

When run on Python 4, this will run the Python 2 code! Instead, use six.PY2.

Found using

Pull Request Checklist

  • Changes have tests
  • News fragment added in changelog.d. See documentation for details

Copy link

@jaraco jaraco commented Jan 12, 2020

Perhaps this issue should be fixed in six rather than in every package on PyPI. I'm pretty sure PY3 was never meant to mean PY<4.

@jaraco jaraco merged commit 70b3ec0 into pypa:master Jan 12, 2020
6 checks passed
@hugovk hugovk deleted the fix-flake8-2020 branch Jan 12, 2020
Copy link
Contributor Author

@hugovk hugovk commented Jan 12, 2020

It's a WONTFIX in six.


Copy link

@Harmon758 Harmon758 commented Jan 12, 2020

Note, it's almost certainly going to be 3.10. That's the consensus from the Python-Dev mailing list and that's what's being used to reference the future release in PEPs and CPython. There's even references to 3.11 and 3.12 already.

Copy link
Contributor Author

@hugovk hugovk commented Jan 12, 2020

Thanks for the link!

Copy link

@webknjaz webknjaz commented Jan 14, 2020

Found using asottile/flake8-2020

Maybe this should also be added to tests/requirements.txt

Copy link
Contributor Author

@hugovk hugovk commented Jan 14, 2020

Good idea, please see PR #1968.

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

Successfully merging this pull request may close these issues.

None yet

4 participants