Commit 0334c3c7 authored by Berker Peksag's avatar Berker Peksag

Issue #26401: Fix compile() documentation

After 25032ec29315, compile() will raise a ValueError
if source contains null bytes.

Patch by SilentGhost.
parent 31feb71f
...@@ -230,7 +230,7 @@ are always available. They are listed here in alphabetical order. ...@@ -230,7 +230,7 @@ are always available. They are listed here in alphabetical order.
or ``2`` (docstrings are removed too). or ``2`` (docstrings are removed too).
This function raises :exc:`SyntaxError` if the compiled source is invalid, This function raises :exc:`SyntaxError` if the compiled source is invalid,
and :exc:`TypeError` if the source contains null bytes. and :exc:`ValueError` if the source contains null bytes.
If you want to parse Python code into its AST representation, see If you want to parse Python code into its AST representation, see
:func:`ast.parse`. :func:`ast.parse`.
...@@ -246,6 +246,10 @@ are always available. They are listed here in alphabetical order. ...@@ -246,6 +246,10 @@ are always available. They are listed here in alphabetical order.
Allowed use of Windows and Mac newlines. Also input in ``'exec'`` mode Allowed use of Windows and Mac newlines. Also input in ``'exec'`` mode
does not have to end in a newline anymore. Added the *optimize* parameter. does not have to end in a newline anymore. Added the *optimize* parameter.
.. versionchanged:: 3.5
Previously, :exc:`TypeError` was raised when null bytes were encountered
in *source*.
.. class:: complex([real[, imag]]) .. class:: complex([real[, imag]])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment