Skip to content

Issue #90: Port setup.py to Python 3.9 #94

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
Closed

Issue #90: Port setup.py to Python 3.9 #94

wants to merge 1 commit into from

Conversation

vstinner
Copy link

Avoid "U" mode in open(). This flag was ignored since Python 3.0 and
now raises an error in Python 3.9:
https://bugs.python.org/issue37330

On Python 2, setup.py no longer replaces DOS (\r\n) and Mac (\r) with
Unix newline (\n). But it is not an issue in practice, since
README.rst uses Unix newline format (\n).

Fix also a ResourceWarning: use "with" context manager to ensure that
the file is closed. The warning was displayed when using
"python3 -Wd setup.py (...)".

Avoid "U" mode in open(). This flag was ignored since Python 3.0 and
now raises an error in Python 3.9:
https://bugs.python.org/issue37330

On Python 2, setup.py no longer replaces DOS (\r\n) and Mac (\r) with
Unix newline (\n). But it is not an issue in practice, since
README.rst uses Unix newline format (\n).

Fix also a ResourceWarning: use "with" context manager to ensure that
the file is closed. The warning was displayed when using
"python3 -Wd setup.py (...)".
@vstinner
Copy link
Author

vstinner commented Mar 18, 2020

Example without the fix on Python 3.9.0a4 on Fedora 31:

$ python3.9 setup.py build
Traceback (most recent call last):
  File "/home/vstinner/parameterized/setup.py", line 11, in <module>
    long_description = open("README.rst", "U").read()
ValueError: invalid mode: 'U'

It works as expected (no error) with the fix:

$ python3.9 setup.py build
(...)
copying parameterized/__init__.py -> build/lib/parameterized
copying parameterized/parameterized.py -> build/lib/parameterized
copying parameterized/test.py -> build/lib/parameterized

@vstinner
Copy link
Author

vstinner commented Apr 6, 2020

@wolever: Would you mind to review this change?

@wolever wolever force-pushed the master branch 5 times, most recently from 640abb4 to 77727e3 Compare April 12, 2020 19:42
@wolever
Copy link
Owner

wolever commented Apr 12, 2020

Thanks! Fix will be out on 0.7.3 (pushing shortly)

@wolever wolever closed this Apr 12, 2020
@vstinner vstinner deleted the py39 branch April 13, 2020 10:49
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.

None yet

2 participants