[Python-checkins] bpo-38872: Document exec symbol for codeop.compile_command (GH-20047) (GH-20098)
Miss Islington (bot)
webhook-mailer at python.org
Thu May 14 21:38:25 EDT 2020
https://github.com/python/cpython/commit/eb5ce324f724a59c51d7a76d1dd49b550cdf386b
commit: eb5ce324f724a59c51d7a76d1dd49b550cdf386b
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-05-14T22:38:17-03:00
summary:
bpo-38872: Document exec symbol for codeop.compile_command (GH-20047) (GH-20098)
* Document exec symbol for codeop.compile_command
* Remove extra statements
Co-authored-by: nanjekyejoannah <joannah.nanjekye at ibm.com>
(cherry picked from commit 7ba1f75f3f02b4b50ac6d7e17d15e467afa36aac)
Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah at users.noreply.github.com>
Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah at users.noreply.github.com>
files:
M Doc/library/code.rst
M Doc/library/codeop.rst
M Lib/codeop.py
diff --git a/Doc/library/code.rst b/Doc/library/code.rst
index 6708079f778c1..538e5afc7822a 100644
--- a/Doc/library/code.rst
+++ b/Doc/library/code.rst
@@ -56,8 +56,8 @@ build applications which provide an interactive interpreter prompt.
*source* is the source string; *filename* is the optional filename from which
source was read, defaulting to ``'<input>'``; and *symbol* is the optional
- grammar start symbol, which should be either ``'single'`` (the default) or
- ``'eval'``.
+ grammar start symbol, which should be ``'single'`` (the default), ``'eval'``
+ or ``'exec'``.
Returns a code object (the same as ``compile(source, filename, symbol)``) if the
command is complete and valid; ``None`` if the command is incomplete; raises
diff --git a/Doc/library/codeop.rst b/Doc/library/codeop.rst
index a52d2c62c4fea..c66b9d3ec0a26 100644
--- a/Doc/library/codeop.rst
+++ b/Doc/library/codeop.rst
@@ -43,8 +43,9 @@ To do just the former:
:exc:`OverflowError` or :exc:`ValueError` if there is an invalid literal.
The *symbol* argument determines whether *source* is compiled as a statement
- (``'single'``, the default) or as an :term:`expression` (``'eval'``). Any
- other value will cause :exc:`ValueError` to be raised.
+ (``'single'``, the default), as a sequence of statements (``'exec'``) or
+ as an :term:`expression` (``'eval'``). Any other value will
+ cause :exc:`ValueError` to be raised.
.. note::
diff --git a/Lib/codeop.py b/Lib/codeop.py
index 0fa677f609b74..3c37f35eb0250 100644
--- a/Lib/codeop.py
+++ b/Lib/codeop.py
@@ -112,7 +112,8 @@ def compile_command(source, filename="<input>", symbol="single"):
source -- the source string; may contain \n characters
filename -- optional filename from which source was read; default
"<input>"
- symbol -- optional grammar start symbol; "single" (default) or "eval"
+ symbol -- optional grammar start symbol; "single" (default), "exec"
+ or "eval"
Return value / exceptions raised:
More information about the Python-checkins
mailing list