[issue37971] Wrong trace with multiple decorators (linenumber wrong in frame)

2021-12-10 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset b593bdc7803cc75461f6fad03cb7d8dfc416 by Carl Friedrich Bolz-Tereick in branch 'main': bpo-37971: fix the position of decorator application (GH-30027) https://github.com/python/cpython/commit/b593bdc7803cc75461f6fad03cb7d8dfc416

[issue37971] Wrong trace with multiple decorators (linenumber wrong in frame)

2021-12-10 Thread Carl Friedrich Bolz-Tereick
Change by Carl Friedrich Bolz-Tereick : -- pull_requests: +28252 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30027 ___ Python tracker ___

[issue37971] Wrong trace with multiple decorators (linenumber wrong in frame)

2021-12-10 Thread Carl Friedrich Bolz-Tereick
Carl Friedrich Bolz-Tereick added the comment: I ran into this problem in PyPy today, preparing a patch for CPython too (without looking at the old one). -- nosy: +Carl.Friedrich.Bolz ___ Python tracker

[issue37971] Wrong trace with multiple decorators (linenumber wrong in frame)

2019-08-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for your patch Joran. We now use GitHub, do you mind to create a pull request? You need to use 4-spaces indentation instead of tabs. Would be nice if you have signed the PSF contributor agreement https://www.python.org/psf/contrib/contrib-form/

[issue37971] Wrong trace with multiple decorators (linenumber wrong in frame)

2019-08-29 Thread Joran van Apeldoorn
Joran van Apeldoorn added the comment: After compiling 3.7 and 3.8 as well it seems that the change happened between those versions. I was a able to patch compiler.c for 3.9 to make it work (first time changing cpython internals, so no guarantees). Patch is attached. This trips up one of

[issue37971] Wrong trace with multiple decorators (linenumber wrong in frame)

2019-08-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It makes sense. If write decorators as explicit function calls: decorated = ( deco1( deco2( original ) ) ) The line number of decorator itself will be used for CALL_FUNCTION: 2 0 LOAD_NAME0

[issue37971] Wrong trace with multiple decorators (linenumber wrong in frame)

2019-08-29 Thread Joran van Apeldoorn
Joran van Apeldoorn added the comment: Digging around with the disassembler shows that this originates in the bytecode. Code: import dis src = """ def printingdec(f): raise Exception() return f def dummydec(f): return f @printingdec @dummydec def foo(): pass """

[issue37971] Wrong trace with multiple decorators (linenumber wrong in frame)

2019-08-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In Python 3.8+ I got: Traceback (most recent call last): File "/home/serhiy/py/cpython/issue37971.py", line 10, in def foo(): File "/home/serhiy/py/cpython/issue37971.py", line 2, in printingdec raise Exception() Exception The traceback refers

[issue37971] Wrong trace with multiple decorators (linenumber wrong in frame)

2019-08-28 Thread Joran van Apeldoorn
New submission from Joran van Apeldoorn : 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