New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
confusing error for file("foo", "w++") #49079
Comments
Specifying the '+' more than once while opening a file results in the Further, the patch checks these after the loop that parses the mode |
On trunk, it seems that it's perfectly happy if you specify more than Python 2.7a0 (trunk, May 29 2009, 05:57:26)
[GCC 4.0.1 (Apple Inc. build 5470) (Aspen 5470.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> open('foo.txt', 'w++')
<open file 'foo.txt', mode 'w++' at 0x39b2a0> Is this still really an issue then? The current trunk also allows |
Good catch, it just took me a while to actually figure out myself where import io
io.FileIO('foo.text', 'w++') This will yield "ValueError: Must have exactly one of read/write/append BTW: In other words, Python 2.6 is behaving a bit inconsistent here. The |
The offending lines in io.py are: In particular, the "or len(mode) > len(modes)" is picking off the fact OTOH, someone obviously wanted to make sure that repeat mode characters |
Amended error message in r85773. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: