Message350686
When applying multiple decorators to a function, a traceback from the top generator shows the bottom generator instead.
For example
----------------
def printingdec(f):
raise Exception()
return f
def dummydec(f):
return f
@printingdec
@dummydec
def foo():
pass
----------------
gives
Traceback (most recent call last):
File "bug.py", line 9, in <module>
@dummydec
File "bug.py", line 2, in printingdec
raise Exception()
Exception
instead of
Traceback (most recent call last):
File "bug.py", line 8, in <module>
@printingdec
File "bug.py", line 2, in printingdec
raise Exception()
Exception
Digging around with sys._getframe() it seems that the frame's linenumber is set wrong internally, leading to the wrong line being displayed.
The ast does display the correct linenumber. |
|
Date |
User |
Action |
Args |
2019-08-28 18:32:52 | control-k | set | recipients:
+ control-k |
2019-08-28 18:32:52 | control-k | set | messageid: <1567017172.25.0.486267767179.issue37971@roundup.psfhosted.org> |
2019-08-28 18:32:52 | control-k | link | issue37971 messages |
2019-08-28 18:32:52 | control-k | create | |
|