Skip to content

Commit f5c96db

Browse files
committed
document that compile() can take bytes (closes #19910)
1 parent cacadf5 commit f5c96db

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Doc/library/functions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ are always available. They are listed here in alphabetical order.
193193
.. function:: compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)
194194

195195
Compile the *source* into a code or AST object. Code objects can be executed
196-
by :func:`exec` or :func:`eval`. *source* can either be a string or an AST
197-
object. Refer to the :mod:`ast` module documentation for information on how
198-
to work with AST objects.
196+
by :func:`exec` or :func:`eval`. *source* can either be a normal string, a
197+
byte string, or an AST object. Refer to the :mod:`ast` module documentation
198+
for information on how to work with AST objects.
199199

200200
The *filename* argument should give the file from which the code was read;
201201
pass some recognizable value if it wasn't read from a file (``'<string>'`` is

Python/bltinmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ builtin_compile(PyObject *self, PyObject *args, PyObject *kwds)
676676
PyDoc_STRVAR(compile_doc,
677677
"compile(source, filename, mode[, flags[, dont_inherit]]) -> code object\n\
678678
\n\
679-
Compile the source string (a Python module, statement or expression)\n\
679+
Compile the source (a Python module, statement or expression)\n\
680680
into a code object that can be executed by exec() or eval().\n\
681681
The filename will be used for run-time error messages.\n\
682682
The mode must be 'exec' to compile a module, 'single' to compile a\n\

0 commit comments

Comments
 (0)