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

Serhiy Storchaka report at bugs.python.org
Thu Aug 29 08:43:12 EDT 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> 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_NAME                0 (deco1)

  3           2 LOAD_NAME                1 (deco2)

  4           4 LOAD_NAME                2 (original)

  3           6 CALL_FUNCTION            1

  2           8 CALL_FUNCTION            1

  1          10 STORE_NAME               3 (decorated)
             12 LOAD_CONST               0 (None)
             14 RETURN_VALUE

But I suppose this will add more headache for coverage.py.

----------
nosy: +nedbat

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37971>
_______________________________________


More information about the Python-bugs-list mailing list