mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Disallow opening files with modes 'aU' or 'wU' as specified by PEP
278. Closes bug 967182.
This commit is contained in:
parent
7961aa6135
commit
bbf12ba7b2
3 changed files with 64 additions and 0 deletions
|
@ -40,6 +40,16 @@ for attr in 'name', 'mode', 'closed':
|
|||
raise TestFailed('expected exception setting file attr %r' % attr)
|
||||
f.close()
|
||||
|
||||
# check invalid mode strings
|
||||
for mode in ("", "aU", "wU+"):
|
||||
try:
|
||||
f = file(TESTFN, mode)
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
f.close()
|
||||
raise TestFailed('%r is an invalid file mode' % mode)
|
||||
|
||||
# verify writelines with instance sequence
|
||||
l = UserList(['1', '2'])
|
||||
f = open(TESTFN, 'wb')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue