Skip to content

Conversation

@hugovk
Copy link
Contributor

@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")
else:
    print "Python 2 code"

Where:

PY3 = sys.version_info[0] == 3

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

Found using https://github.com/asottile/flake8-2020

Pull Request Checklist

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

@jaraco
Copy link
Member

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
@hugovk hugovk deleted the fix-flake8-2020 branch January 12, 2020 06:42
@hugovk
Copy link
Contributor Author

hugovk commented Jan 12, 2020

It's a WONTFIX in six.

benjaminp/six#297

@Harmon758
Copy link

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.

@hugovk
Copy link
Contributor Author

hugovk commented Jan 12, 2020

Thanks for the link!

@webknjaz
Copy link
Member

Found using asottile/flake8-2020

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

@hugovk
Copy link
Contributor Author

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants