New submission from Joran van Apeldoorn <[email protected]>:
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.
----------
messages: 350686
nosy: control-k
priority: normal
severity: normal
status: open
title: Wrong trace with multiple decorators (linenumber wrong in frame)
type: behavior
versions: Python 3.6
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37971>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com