diff --git a/pep-0511.txt b/pep-0511.txt index 0cd209bca..0e8be8d6b 100644 --- a/pep-0511.txt +++ b/pep-0511.txt @@ -263,32 +263,32 @@ to join code transformer names to build the optimizer tag. ``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