Skip to content

Commit aa72b54

Browse files
committed
Adjust test to the change in CPython, parser now raises SyntaxError instead of ValueError when source code contains null bytes
1 parent 9ca0bda commit aa72b54

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/test_future/test_builtins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,8 @@ def test_compile(self):
523523
self.assertRaises(TypeError, compile)
524524
self.assertRaises(ValueError, compile, 'print(42)\n', '<string>', 'badmode')
525525
self.assertRaises(ValueError, compile, 'print(42)\n', '<string>', 'single', 0xff)
526-
# Raises TypeError in Python < v3.5, ValueError in v3.5:
527-
self.assertRaises((TypeError, ValueError), compile, chr(0), 'f', 'exec')
526+
# Raises TypeError in Python < v3.5, ValueError in v3.5, SyntaxError in >= 3.12:
527+
self.assertRaises((TypeError, ValueError, SyntaxError), compile, chr(0), 'f', 'exec')
528528
self.assertRaises(TypeError, compile, 'pass', '?', 'exec',
529529
mode='eval', source='0', filename='tmp')
530530
compile('print("\xe5")\n', '', 'exec')

0 commit comments

Comments
 (0)