From 2002aa056a1990907d85889bc67862f67fa8f9d1 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 13 Feb 2016 02:54:18 +0100 Subject: [PATCH] PEP 511: code transformer context --- pep-0511.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pep-0511.txt b/pep-0511.txt index 44faf4080..4a0766139 100644 --- a/pep-0511.txt +++ b/pep-0511.txt @@ -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.