-
-
Notifications
You must be signed in to change notification settings - Fork 32.9k
Open
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dir
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
This function raises :exc:`SyntaxError` if the compiled source is invalid, | |
and :exc:`ValueError` if the source contains null bytes. |
And
Line 2158 in d1a1bca
If source contains a null character (``\0``), :exc:`ValueError` is raised. |
Linked PRs
Metadata
Metadata
Assignees
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dir