PEP 511: code transformer context

This commit is contained in:
Victor Stinner 2016-02-13 02:54:18 +01:00
parent 4da7e41f94
commit 2002aa056a
1 changed files with 13 additions and 0 deletions

View File

@ -277,6 +277,19 @@ Prototype::
Parameters:
* *code*: code object
* *context*: an object with an *optimize* attribute (``int``), the optimization
level (0, 1 or 2). The value of the *optimize* attribute comes from the
*optimize* parameter of the ``compile()`` function, it is equal to
``sys.flags.optimize`` by default.
Each implementation of Python can add extra attributes to *context*. For
example, on CPython, *context* will also have the following attribute:
* *interactive* (``bool``): true if in interactive mode
XXX add more flags?
XXX replace flags int with a sub-namespace, or with specific attributes?
The method must return a code object.