Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Don't use deprecated 'U' flag to read manifest #623
The universal newlines mode ('U' flag) is deprecated since Python
Example of warning:
.../setuptools/command/sdist.py:182: DeprecationWarning: 'U' mode is deprecated
The universal newlines mode ('U' flag) is deprecated since Python 3.4. It only replaces "\r\n" with "\n", but it doesn't split lines at "\r" (Mac newline). In practice, the flag was useless, the sdist.read_manifest() method already uses line.strip() and so removes newline characters.
New test on Python 2:
Oh wait: replacing "rbU" with "rb" doesn't work for Mac newline (\r) :-/ I made a mistake in my previous test.
Test on Python 3:
On Python 3, the "U" flag is simply ignored for binary mode and Mac newlines don't work as expected.
I'm all but certain we don't need to support Mac newlines any longer. I agree about the tests, with the caveat that setuptools has never had suitable use-case coverage, so we have to be extra considerate. In this case, let's make the change and if someone complains, we'll add the necessary test.