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
[doc] codecs.open() + eol (windows) #51511
Comments
different eol when writing to fp = codecs.open(.., 'w', 'cp866') def write(fp):
fp.write("""\
a
""")
# eol=0d0a (windows, python-2.6.4)
with open('0d0a.tmp', 'w') as fp:
write(fp)
# eol=0d0a (windows, python-2.6.4)
with codecs.open('0d0a-codecs.tmp', 'w') as fp:
write(fp) # --- BUG --- # eol=0a (windows, python-2.6.4)
with codecs.open('0a-codecs.tmp', 'w', 'cp866') as fp:
write(fp) |
The docs say:: But this does not match the code of codecs.open():: When the encoding is None, the file is opened in text mode. |
Amaury Forgeot d'Arc wrote:
Agreed, it's a documentation bug. If no encoding is specified, The idea was to provide a drop-in replacement for open() - with Perhaps the default mode should have been 'r' to match the |
The docs still read the same. Would someone in the know like to propose a doc patch please. |
Hi, |
That paragraph was edited here: but this point was not added. |
…tic conversion to binary mode (#94370)
…automatic conversion to binary mode (pythonGH-94370) (cherry picked from commit d9407b1) Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
…automatic conversion to binary mode (pythonGH-94370) (cherry picked from commit d9407b1) Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
Thanks, looks like this was completed |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: