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.

Title: redundant open modes 'rbb', 'wbb', 'abb' no longer work on Windows
Type: behavior Stage: resolved
Components: Interpreter Core, Windows Versions: Python 2.7
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, ezio.melotti, ishimoto, ivank, loewis, pitrou
Priority: normal Keywords:

Created on 2010-01-13 00:28 by ivank, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg97674 - (view) Author: ivank (ivank) Date: 2010-01-13 00:28
This probably only applies to Windows. The redundant 'b' modes still work on Linux.

These worked on Windows in 2.6.4:

open('test', 'rbb')
open('test', 'wbb')
open('test', 'abb')

and possibly others.

In 2.7a2, they throw ValueErrors like this:

>>> open('test', 'wbb')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Invalid mode ('wbb')

It would be nice if the old behavior were preserved for backwards compatibility. Some programs append a 'b' indiscriminately.
msg97685 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2010-01-13 05:12
With 2.7 I can reproduce the issue on Windows 7 (i.e. I get a ValueError).
However I'm not sure how common is to add a 'b' indiscriminately:
1) most of the times the modes are written as strings, and not generated automatically;
2) even if generated, checking if there's a 'b' is as easy as doing "if 'b' not in mode: mode = mode + 'b'".

For consistency both Windows and Linux should have the same behavior, and if the extra 'b' is not so common I think it's better if both raise an error.
msg192567 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-07-07 14:50
For Python 2.7 we can no longer do anything about it. Any chance might break 3rd party software. Python 3.x and Python 2.7's io module don't allow redundant information.

I suggest that you follow Ezio's advice and check for redundancy in your application.
Date User Action Args
2022-04-11 14:56:56adminsetgithub: 51935
2013-07-07 14:50:19christian.heimessetstatus: open -> closed

nosy: + christian.heimes
messages: + msg192567

resolution: wont fix
stage: test needed -> resolved
2012-10-02 05:28:38ezio.melottisetnosy: + pitrou
2012-07-30 15:23:00ishimotosetnosy: + ishimoto
2010-05-20 20:35:45skip.montanarosetnosy: - skip.montanaro
2010-01-13 12:58:22skip.montanarosetnosy: + skip.montanaro
2010-01-13 05:48:00loewissetnosy: + loewis
2010-01-13 05:12:46ezio.melottisetnosy: + ezio.melotti
messages: + msg97685

components: + Interpreter Core, Windows
stage: needs patch -> test needed
2010-01-13 00:46:37brian.curtinsetpriority: normal
stage: needs patch
2010-01-13 00:28:55ivankcreate