[Python-checkins] cpython (merge 3.5 -> default): Issue #26401: Fix compile() documentation

berker.peksag python-checkins at python.org
Sun Feb 21 15:00:20 EST 2016


https://hg.python.org/cpython/rev/45cf82f424ce
changeset:   100289:45cf82f424ce
parent:      100287:f555ef42ad62
parent:      100288:0cfac9efd895
user:        Berker Peksag <berker.peksag at gmail.com>
date:        Sun Feb 21 22:00:29 2016 +0200
summary:
  Issue #26401: Fix compile() documentation

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

Patch by SilentGhost.

files:
  Doc/library/functions.rst |  6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -230,7 +230,7 @@
    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 @@
       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]])
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list