@@ -544,7 +544,7 @@ def test_particularly_evil_undecodable(self):
544544 with open (fn , "wb" ) as fp :
545545 fp .write (src )
546546 res = script_helper .run_python_until_end (fn )[0 ]
547- self .assertIn (b"Non-UTF-8 " , res .err )
547+ self .assertIn (b"source code cannot contain null bytes " , res .err )
548548
549549 def test_yet_more_evil_still_undecodable (self ):
550550 # Issue #25388
@@ -554,7 +554,7 @@ def test_yet_more_evil_still_undecodable(self):
554554 with open (fn , "wb" ) as fp :
555555 fp .write (src )
556556 res = script_helper .run_python_until_end (fn )[0 ]
557- self .assertIn (b"Non-UTF-8 " , res .err )
557+ self .assertIn (b"source code cannot contain null bytes " , res .err )
558558
559559 @support .cpython_only
560560 @unittest .skipIf (support .is_wasi , "exhausts limited stack on WASI" )
@@ -591,9 +591,9 @@ def check_limit(prefix, repeated, mode="single"):
591591 def test_null_terminated (self ):
592592 # The source code is null-terminated internally, but bytes-like
593593 # objects are accepted, which could be not terminated.
594- with self .assertRaisesRegex (ValueError , "cannot contain null" ):
594+ with self .assertRaisesRegex (SyntaxError , "cannot contain null" ):
595595 compile ("123\x00 " , "<dummy>" , "eval" )
596- with self .assertRaisesRegex (ValueError , "cannot contain null" ):
596+ with self .assertRaisesRegex (SyntaxError , "cannot contain null" ):
597597 compile (memoryview (b"123\x00 " ), "<dummy>" , "eval" )
598598 code = compile (memoryview (b"123\x00 " )[1 :- 1 ], "<dummy>" , "eval" )
599599 self .assertEqual (eval (code ), 23 )
0 commit comments