summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-02-21 20:00:12 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-02-21 20:00:12 (GMT)
commit0334c3c735a3616c5016b8013796ca08307f88de (patch)
tree739dffc27317149181f19363e8ced99848e12553
parent31feb71f802fe9778b162d55f2f55d3abe4854a8 (diff)
downloadcpython-0334c3c735a3616c5016b8013796ca08307f88de.zip
cpython-0334c3c735a3616c5016b8013796ca08307f88de.tar.gz
cpython-0334c3c735a3616c5016b8013796ca08307f88de.tar.bz2
Issue #26401: Fix compile() documentation
After 25032ec29315, compile() will raise a ValueError if source contains null bytes. Patch by SilentGhost.
-rw-r--r--Doc/library/functions.rst6
1 files changed, 5 insertions, 1 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 6e98cfb..65f53dd 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -230,7 +230,7 @@ are always available. They are listed here in alphabetical order.
or ``2`` (docstrings are removed too).
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
:func:`ast.parse`.
@@ -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
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]])