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:
Georg Brandl 2006-05-18 07:01:27 +00:00
parent b678ce5aa6
commit 7b90e168f3
4 changed files with 61 additions and 38 deletions

View file

@ -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: