Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit7ba1f75

Browse files
nanjekyejoannahnanjekyejoannah
and
nanjekyejoannah
authored
bpo-38872: Document exec symbol for codeop.compile_command (GH-20047)
* Document exec symbol for codeop.compile_command* Remove extra statementsCo-authored-by: nanjekyejoannah <joannah.nanjekye@ibm.com>
1 parent4b972fa commit7ba1f75

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

‎Doc/library/code.rst‎

Lines 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 beeither``'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‎

Lines 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‎

Lines 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)

[8]ページ先頭

©2009-2025 Movatter.jp