classification
Title: redundant open modes 'rbb', 'wbb', 'abb' no longer work on Windows
Type: behavior Stage: test needed
Components: Interpreter Core, Windows Versions: Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, ivank, loewis
Priority: normal Keywords:

Created on 2010-01-13 00:28 by ivank, last changed 2010-05-20 20:35 by skip.montanaro.

Messages (2)
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.
History
Date User Action Args
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