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
Document os.open #52646
Comments
Need to document the that os.O_BINARY flag is obligatory for cross-platform behavior of os.open() on Windows. By default os.open() opens file as binary on Unix, but as text on Windows. See also bpo-2028 for discussion of making os.O_BINARY default on py3k. I can reopen this issue. |
s/ can / can't / |
Since there is no distinction between text and binary mode on Unix, you shouldn't claim the behavior is not consistent - you get text mode. You need O_BINARY on Windows to get binary mode. O_BINARY is already documented; I've added a better link to it from the description of os.open() in r80069. Do not reopen bpo-2028, it was not about os.open() anyway. For os.open(), |
On Unix all files are opened in binary mode. On Windows linefeeds are translated to CRLF corrupting files that are meant to be binary. This is the reason of HgGit failure - it uses Dulwich library that creates corrupted Git index file, because on Windows it is opened without os.O_BINARY flag. Developers do not know anything about it, because they develop on Unix. This could be prevented if we supply a note about how to preserve crossplatform behavior. I've attached a patch that adds required note. Please revise it. It should clearly apply over your changes in r80069. I reworded description towards Python users without C background, but I am still worried that they need a POSIX background to understand umask part. |
I've added a paragraph about O_BINARY in r80080. |
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: