mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #22215: Now ValueError is raised instead of TypeError when str or bytes
argument contains not permitted null character or byte.
This commit is contained in:
parent
4a4b679515
commit
d8a1447c99
14 changed files with 41 additions and 39 deletions
|
@ -312,11 +312,11 @@ class BuiltinTest(unittest.TestCase):
|
|||
self.assertRaises(TypeError, compile)
|
||||
self.assertRaises(ValueError, compile, 'print(42)\n', '<string>', 'badmode')
|
||||
self.assertRaises(ValueError, compile, 'print(42)\n', '<string>', 'single', 0xff)
|
||||
self.assertRaises(TypeError, compile, chr(0), 'f', 'exec')
|
||||
self.assertRaises(ValueError, compile, chr(0), 'f', 'exec')
|
||||
self.assertRaises(TypeError, compile, 'pass', '?', 'exec',
|
||||
mode='eval', source='0', filename='tmp')
|
||||
compile('print("\xe5")\n', '', 'exec')
|
||||
self.assertRaises(TypeError, compile, chr(0), 'f', 'exec')
|
||||
self.assertRaises(ValueError, compile, chr(0), 'f', 'exec')
|
||||
self.assertRaises(ValueError, compile, str('a = 1'), 'f', 'bad')
|
||||
|
||||
# test the optimize argument
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue