@@ -544,7 +544,7 @@ def test_particularly_evil_undecodable(self):
544
544
with open (fn , "wb" ) as fp :
545
545
fp .write (src )
546
546
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 )
548
548
549
549
def test_yet_more_evil_still_undecodable (self ):
550
550
# Issue #25388
@@ -554,7 +554,7 @@ def test_yet_more_evil_still_undecodable(self):
554
554
with open (fn , "wb" ) as fp :
555
555
fp .write (src )
556
556
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 )
558
558
559
559
@support .cpython_only
560
560
@unittest .skipIf (support .is_wasi , "exhausts limited stack on WASI" )
@@ -591,9 +591,9 @@ def check_limit(prefix, repeated, mode="single"):
591
591
def test_null_terminated (self ):
592
592
# The source code is null-terminated internally, but bytes-like
593
593
# objects are accepted, which could be not terminated.
594
- with self .assertRaisesRegex (ValueError , "cannot contain null" ):
594
+ with self .assertRaisesRegex (SyntaxError , "cannot contain null" ):
595
595
compile ("123\x00 " , "<dummy>" , "eval" )
596
- with self .assertRaisesRegex (ValueError , "cannot contain null" ):
596
+ with self .assertRaisesRegex (SyntaxError , "cannot contain null" ):
597
597
compile (memoryview (b"123\x00 " ), "<dummy>" , "eval" )
598
598
code = compile (memoryview (b"123\x00 " )[1 :- 1 ], "<dummy>" , "eval" )
599
599
self .assertEqual (eval (code ), 23 )
0 commit comments