You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Another closure wrapping bug
This commit is contained in:
27
test/simple_source/def/07_closure_bug2.py
Normal file
27
test/simple_source/def/07_closure_bug2.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Tests bug in Python 3
|
||||||
|
|
||||||
|
# Note also check that *args, and **kwds are preserved
|
||||||
|
# on the call!
|
||||||
|
|
||||||
|
# load_closure ::= LOAD_CLOSURE LOAD_CLOSURE BUILD_TUPLE_2
|
||||||
|
|
||||||
|
# Python 3.5
|
||||||
|
# mkfunc ::= load_closure LOAD_CONST LOAD_CONST MAKE_CLOSURE_0
|
||||||
|
|
||||||
|
# Python 3.2
|
||||||
|
# mkfunc ::= load_closure LOAD_CONST MAKE_CLOSURE_0
|
||||||
|
|
||||||
|
# mkfuncdeco0 ::= mkfunc
|
||||||
|
# mkfuncdeco ::= expr mkfuncdeco0 CALL_FUNCTION_1
|
||||||
|
# designator ::= STORE_FAST
|
||||||
|
# funcdefdeco ::= mkfuncdeco designator
|
||||||
|
# stmt ::= funcdefdeco
|
||||||
|
from functools import wraps
|
||||||
|
|
||||||
|
class ContextDecorator(object):
|
||||||
|
def __call__(self, func):
|
||||||
|
@wraps(func)
|
||||||
|
def inner(*args, **kwds):
|
||||||
|
with self._recreate_cm():
|
||||||
|
return func(*args, **kwds)
|
||||||
|
return inner
|
Reference in New Issue
Block a user