Skip to content

Commit eeb1ceb

Browse files
Make compile() exception description more vague
1 parent 3b2c009 commit eeb1ceb

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

Doc/library/functions.rst

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,8 @@ are always available. They are listed here in alphabetical order.
340340
It is needed to unambiguous :ref:`filter <warning-filter>` syntax warnings
341341
by module name.
342342

343-
This function raises the following exceptions:
344-
345-
- :exc:`SyntaxError` if the compiled source is invalid
346-
- :exc:`ValueError` if the source contains null bytes
347-
- :exc:`UnicodeDecodeError` if the source code contains docstrings that
348-
cannot be encoded as UTF-8 and the optimization level is below ``2``
343+
This function raises :exc:`SyntaxError` or :exc:`ValueError` if the compiled
344+
source is invalid.
349345

350346
If you want to parse Python code into its AST representation, see
351347
:func:`ast.parse`.
@@ -377,11 +373,6 @@ are always available. They are listed here in alphabetical order.
377373
Previously, :exc:`TypeError` was raised when null bytes were encountered
378374
in *source*.
379375

380-
.. versionchanged:: 3.13
381-
:exc:`UnicodeDecodeError` is now raised if any docstring in *source*
382-
contains surrogates (like ``\ud800``) and therefore cannot be encoded
383-
as UTF-8.
384-
385376
.. versionadded:: 3.8
386377
``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable
387378
support for top-level ``await``, ``async for``, and ``async with``.

0 commit comments

Comments
 (0)