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 for discussion of making os.O_BINARY default on py3k. I can reopen this issue.
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 #2028, it was not about os.open() anyway. For os.open(), as it is only a wrapper for the OS's own POSIX layer, the flags argument shouldn't be touched.
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. https://bugs.edge.launchpad.net/dulwich/+bug/557585 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.