Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c1203b7

Browse filesBrowse files
bpo-38872: Document exec symbol for codeop.compile_command (GH-20047) (#20099)
* Document exec symbol for codeop.compile_command * Remove extra statements Co-authored-by: nanjekyejoannah <joannah.nanjekye@ibm.com> (cherry picked from commit 7ba1f75) Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com> Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com>
1 parent 61b49a0 commit c1203b7
Copy full SHA for c1203b7

File tree

3 files changed

+7
-5
lines changed
Filter options

3 files changed

+7
-5
lines changed

‎Doc/library/code.rst

Copy file name to clipboardExpand all lines: Doc/library/code.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ build applications which provide an interactive interpreter prompt.
5656

5757
*source* is the source string; *filename* is the optional filename from which
5858
source was read, defaulting to ``'<input>'``; and *symbol* is the optional
59-
grammar start symbol, which should be either ``'single'`` (the default) or
60-
``'eval'``.
59+
grammar start symbol, which should be ``'single'`` (the default), ``'eval'``
60+
or ``'exec'``.
6161

6262
Returns a code object (the same as ``compile(source, filename, symbol)``) if the
6363
command is complete and valid; ``None`` if the command is incomplete; raises

‎Doc/library/codeop.rst

Copy file name to clipboardExpand all lines: Doc/library/codeop.rst
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ To do just the former:
4343
:exc:`OverflowError` or :exc:`ValueError` if there is an invalid literal.
4444

4545
The *symbol* argument determines whether *source* is compiled as a statement
46-
(``'single'``, the default) or as an :term:`expression` (``'eval'``). Any
47-
other value will cause :exc:`ValueError` to be raised.
46+
(``'single'``, the default), as a sequence of statements (``'exec'``) or
47+
as an :term:`expression` (``'eval'``). Any other value will
48+
cause :exc:`ValueError` to be raised.
4849

4950
.. note::
5051

‎Lib/codeop.py

Copy file name to clipboardExpand all lines: Lib/codeop.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ def compile_command(source, filename="<input>", symbol="single"):
112112
source -- the source string; may contain \n characters
113113
filename -- optional filename from which source was read; default
114114
"<input>"
115-
symbol -- optional grammar start symbol; "single" (default) or "eval"
115+
symbol -- optional grammar start symbol; "single" (default), "exec"
116+
or "eval"
116117
117118
Return value / exceptions raised:
118119

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.