[Python-checkins] peps: PEP 511
victor.stinner
python-checkins at python.org
Wed Jan 27 05:33:28 EST 2016
https://hg.python.org/peps/rev/649868d62d56
changeset: 6210:649868d62d56
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Jan 27 11:29:51 2016 +0100
summary:
PEP 511
* Change code_transformer() API. The method now takes a code object as input
and must return a code object.
* Be more explicit: code_transformer() and ast_transformer() are methods taking
a self parameter.
files:
pep-0511.txt | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/pep-0511.txt b/pep-0511.txt
--- a/pep-0511.txt
+++ b/pep-0511.txt
@@ -263,32 +263,32 @@
``PyParser_ASTFromStringObject()``.
-code_transformer()
-------------------
+code_transformer() method
+-------------------------
Prototype::
- def code_transformer(code, consts, names, lnotab, context):
+ def code_transformer(self, code, context):
...
- return (code, consts, names, lnotab)
+ new_code = ...
+ ...
+ return new_code
Parameters:
-* *code*: the bytecode (``bytes``)
-* *consts*: a sequence of constants
-* *names*: tuple of variable names
-* *lnotab*: table mapping instruction offsets to line numbers
- (``bytes``)
+* *code*: code object
+
+The method must return a code object.
The code transformer is run after the compilation to bytecode
-ast_transformer()
-------------------
+ast_transformer() method
+------------------------
Prototype::
- def ast_transformer(tree, context):
+ def ast_transformer(self, tree, context):
...
return tree
--
Repository URL: https://hg.python.org/peps
More information about the Python-checkins
mailing list