summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fileio.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-01-29 17:43:36 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-01-29 17:43:36 (GMT)
commit7ab4af0427a100e1054dea6137381c5dbf843530 (patch)
tree5675c8aba99f23694645917896e81ce877263d20 /Lib/test/test_fileio.py
parentcdc878e56298c9da9720f1298a8b780a189ce029 (diff)
parent1334884ff2f5a3968e6a26157f869b4ca5de189b (diff)
downloadcpython-7ab4af0427a100e1054dea6137381c5dbf843530.zip
cpython-7ab4af0427a100e1054dea6137381c5dbf843530.tar.gz
cpython-7ab4af0427a100e1054dea6137381c5dbf843530.tar.bz2
Issue #13848: open() and the FileIO constructor now check for NUL characters in the file name.
Patch by Hynek Schlawack.
Diffstat (limited to 'Lib/test/test_fileio.py')
-rw-r--r--Lib/test/test_fileio.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index 75db82c..9854d0c 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -306,6 +306,11 @@ class OtherFileTests(unittest.TestCase):
finally:
os.unlink(TESTFN)
+ def testConstructorHandlesNULChars(self):
+ fn_with_NUL = 'foo\0bar'
+ self.assertRaises(TypeError, _FileIO, fn_with_NUL, 'w')
+ self.assertRaises(TypeError, _FileIO, bytes(fn_with_NUL, 'ascii'), 'w')
+
def testInvalidFd(self):
self.assertRaises(ValueError, _FileIO, -10)
self.assertRaises(OSError, _FileIO, make_bad_fd())