Issue 7686: redundant open modes 'rbb', 'wbb', 'abb' no longer work on Windows (original) (raw)
Issue7686
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 "", line 1, in 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) * ![]() |
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) * ![]() |
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. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:56 | admin | set | github: 51935 |
2013-07-07 14:50:19 | christian.heimes | set | status: open -> closednosy: + christian.heimesmessages: + resolution: wont fixstage: test needed -> resolved |
2012-10-02 05:28:38 | ezio.melotti | set | nosy: + pitrou |
2012-07-30 15:23:00 | ishimoto | set | nosy: + ishimoto |
2010-05-20 20:35:45 | skip.montanaro | set | nosy: - skip.montanaro |
2010-01-13 12:58:22 | skip.montanaro | set | nosy: + skip.montanaro |
2010-01-13 05:48:00 | loewis | set | nosy: + loewis |
2010-01-13 05:12:46 | ezio.melotti | set | nosy: + ezio.melottimessages: + components: + Interpreter Core, Windowsstage: needs patch -> test needed |
2010-01-13 00:46:37 | brian.curtin | set | priority: normalstage: needs patch |
2010-01-13 00:28:55 | ivank | create |