-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bind local name for decorated function early so it can be closed
- Loading branch information
Showing
5 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,3 +121,4 @@ SIMPLE(OP_TUPLE_FROM_LIST) | |
|
||
OPERAND(OP_UNPACK_EX,NOOP) | ||
JUMP(OP_ENTER_EXCEPT,+) | ||
SIMPLE(OP_SWAP_POP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
def decorate(func): | ||
def _inner(a): | ||
print('in') | ||
a = func(a) | ||
print('out') | ||
return a | ||
return _inner | ||
|
||
def foo(): | ||
@decorate | ||
def bar(a): | ||
if a <= 0: | ||
return 0 | ||
return bar(a-1) | ||
|
||
bar(2) | ||
|
||
foo() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
in | ||
in | ||
in | ||
out | ||
out | ||
out |