codetransformer
codetransformer copied to clipboard
*args after transformation is considerd as a required positional argument
for example:
from codetransformer import CodeTransformer, pattern
from codetransformer.instructions import CALL_FUNCTION
def add(*args):
return sum([*args])
class EmptyTransformer(CodeTransformer):
@pattern(CALL_FUNCTION)
def _call(self, call):
yield call
transformer = EmptyTransformer()
new_add = transformer(add)
add() => 0
new_add() => TypeError: add() missing 1 required positional argument: 'args'
Good find, it looks like we messed up how we represented this information between our Code object and the transformer.
I opened a PR to fix this here: https://github.com/llllllllll/codetransformer/pull/68