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
In attempting to harmonize the path pie implementation with more modern constructs, I'm seeking also to utilize the newline argument to open instead of explicitly substituting characters.
newline
open
When I do, however, I find that some tests start to fail when NEL is passed as a newline character:
$ py -c "open('foo', 'w', newline='\x85')" Traceback (most recent call last): File "<string>", line 1, in <module> ValueError: illegal newline value: �
At least in some contexts, Python recognizes NEL as a line separator:
>>> 'a\x85b\x1ec'.splitlines() ['a', 'b', 'c']
See also #66428 for some background.
According to the wikipedia article, a conforming application should honor a number of characters as newlines:
>>> newlines = '\x0a', '\x0b', '\x0c', '\x0d', '\x0d\x0a', '\u0085', '\u2028', '\u2029' >>> for candidate in newlines: ... try: x=open('foo', 'w', newline=candidate) ... except ValueError: print('failed on', repr(candidate)) ... failed on '\x0b' failed on '\x0c' failed on '\x85' failed on '\u2028' failed on '\u2029'
The text was updated successfully, but these errors were encountered:
The documentation for open:
https://docs.python.org/3/library/functions.html#open
is quite specific in what it supports:
newline controls how universal newlines mode works (it only applies to text mode). It can be None, '', '\n', '\r', and '\r\n'.
None
''
'\n'
'\r'
'\r\n'
Since '\x85' is not among those specific legal values, I don't think this is a bug. It might be a reasonable feature request, though.
'\x85'
Which specific Wikipedia article are you referring to? There's more than one.
Sorry, something went wrong.
No branches or pull requests
jaraco commentedSep 25, 2022
•
edited
In attempting to harmonize the path pie implementation with more modern constructs, I'm seeking also to utilize the
newlineargument toopeninstead of explicitly substituting characters.When I do, however, I find that some tests start to fail when NEL is passed as a newline character:
At least in some contexts, Python recognizes NEL as a line separator:
See also #66428 for some background.
According to the wikipedia article, a conforming application should honor a number of characters as newlines:
The text was updated successfully, but these errors were encountered: