Open
Description
Documentation
Docs for compile()
and ast.parse()
say they raise ValueError
for source contains null bytes. However, since 3.12 (#97594), SyntaxError
is raised instead:
>>> compile("\x00", "lambda.tt", "exec")
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
compile("\x00", "lambda.tt", "exec")
~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: source code string cannot contain null bytes
cpython/Doc/library/functions.rst
Lines 337 to 338 in d1a1bca
And
Line 2158 in d1a1bca