From: Benjamin Peterson Date: Sat, 7 Dec 2013 01:12:39 +0000 (-0500) Subject: document that compile() can take bytes (closes #19910) X-Git-Tag: v3.4.0b2~314^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=933142a8f238529c610edf2100c4208a8ee82805;p=thirdparty%2FPython%2Fcpython.git document that compile() can take bytes (closes #19910) --- diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index b125a78a4bb9..ae29cd8422ed 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -193,9 +193,9 @@ are always available. They are listed here in alphabetical order. .. function:: compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1) Compile the *source* into a code or AST object. Code objects can be executed - by :func:`exec` or :func:`eval`. *source* can either be a string or an AST - object. Refer to the :mod:`ast` module documentation for information on how - to work with AST objects. + by :func:`exec` or :func:`eval`. *source* can either be a normal string, a + byte string, or an AST object. Refer to the :mod:`ast` module documentation + for information on how to work with AST objects. The *filename* argument should give the file from which the code was read; pass some recognizable value if it wasn't read from a file (``''`` is diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index dffdf46a62df..c94daea0272e 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -676,7 +676,7 @@ finally: PyDoc_STRVAR(compile_doc, "compile(source, filename, mode[, flags[, dont_inherit]]) -> code object\n\ \n\ -Compile the source string (a Python module, statement or expression)\n\ +Compile the source (a Python module, statement or expression)\n\ into a code object that can be executed by exec() or eval().\n\ The filename will be used for run-time error messages.\n\ The mode must be 'exec' to compile a module, 'single' to compile a\n\