This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: open should default to binary mode on windows
Type: Stage:
Components: Windows Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: hupp, tim.peters, twouters
Priority: normal Keywords:

Created on 2006-04-09 18:42 by hupp, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg28169 - (view) Author: Adam Hupp (hupp) Date: 2006-04-09 18:42
On windows the open() function defaults to reading
files in text mode.  To get a binary mode file I need
to append a "b" to the mode string.  I think this is an
unnessary platform inconsistency.  Twice now I've had
hard to track down bugs because I was reading a file in
text mode and should have been using binary.  This is a
wart, IMO.  

I'd like to suggest that the default open mode on
windows be made binary, with an option to change it to
text if desired.  

msg28170 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2006-04-10 00:45
Logged In: YES 
user_id=34209

Sorry, that would break too much existing code. For Python
3.0, where it is okay to break existing code, opening a file
will be explicitly text (with automatic decoding to Unicode)
or binary (where reading fetches you bytes, instead of a
string), and the matter will be solved.
msg28171 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2006-04-10 02:02
Logged In: YES 
user_id=31435

Closing this.  It can't be changed now without breaking
mountains of code, and it's debatable that changing it would
be a good idea even if not (Python follows C exactly in this
respect now -- but there's no need to debate it since it
ain't  gonna happen before Python 3 regardless). 
History
Date User Action Args
2022-04-11 14:56:16adminsetgithub: 43181
2006-04-09 18:42:01huppcreate