Skip to content

fix: remove "U" move from open(), now universal newline is the default #31

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sandrotosi
Copy link

@sandrotosi sandrotosi commented Dec 24, 2022

In python2.7 you needed to specify mode='U' to get universal newline: https://docs.python.org/2.7/library/functions.html#open:~:text=universal%20newlines%20support%3B-,supplying%20%27U%27,-opens%20the%20file

in python3 this is now the default: https://docs.python.org/3/library/functions.html#open:~:text=if%20newline%20is%20None%2C%20universal%20newlines%20mode%20is%20enabled

but if left there, it now triggers an error with 3.11, so let's remove it

@CarliJoy
Copy link

@wolever can you merge this? Otherwise we will have troubles using the pkg with Python 3.11.

@thebaptiste
Copy link

@wolever can you merge this? Otherwise we will have troubles using the pkg with Python 3.11.

Yes, pprintpp doesn't work with python 3.11. Please merge and release !

@MatthewZMD
Copy link

MatthewZMD commented Mar 4, 2024

ping @wolever

@suntropez
Copy link

One more friendly ping @wolever 😆

Copy link

@suntropez suntropez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should use io.open ?

@CarliJoy
Copy link

Modern way would be to use simply pathlib.Path with read_text() or better just a pyproject.toml (no setup.py at all) in which you can simply define the README: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#readme

@CarliJoy
Copy link

CarliJoy commented Dec 27, 2024

@wolever If you okay with an merging soon I could prepare an update for using pyproject.toml with setuptools.

@suntropez
Copy link

suntropez commented Dec 27, 2024

Modern way would be to use simply pathlib.Path with read_text() or better just a pyproject.toml (no setup.py at all) in which you can simply define the README: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#readme

The thing there is if the library wishes to remain compatible with Python 3.4 or even 2.7. I think.

@CarliJoy
Copy link

Why support a Python version that reached end of life in a new version of a library?
Especially as you can always use older version of the library that are still compatible with the old Python version.
I think the only reason for it being the way it is, is that this project hasn't seen a commit in 4 years.

@valholl
Copy link

valholl commented Jan 14, 2025

The thing there is if the library wishes to remain compatible with Python 3.4 or even 2.7. I think.

the fix proposed in this PR wouldn't break compatibility and would at least allow pprintpp to work with modern python versions, however.

(beside the fact that both 3.4 and 2.7 have been end-of-life for years by now)

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.

6 participants