mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
Bug #1462152: file() now checks more thoroughly for invalid mode
strings and removes a possible "U" before passing the mode to the C library function.
This commit is contained in:
parent
b678ce5aa6
commit
7b90e168f3
4 changed files with 61 additions and 38 deletions
|
@ -136,7 +136,7 @@ f.close()
|
|||
bad_mode = "qwerty"
|
||||
try:
|
||||
open(TESTFN, bad_mode)
|
||||
except IOError, msg:
|
||||
except ValueError, msg:
|
||||
if msg[0] != 0:
|
||||
s = str(msg)
|
||||
if s.find(TESTFN) != -1 or s.find(bad_mode) == -1:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue