[pypy-commit] [Git][pypy/pypy][branch/release-pypy3.9-v7.x] 3 commits: #3674: fix co_firstlineno of the code object of class bodies with decorators

Matti Picus (@mattip) foss at heptapod.net
Sat Feb 19 11:39:55 EST 2022



Matti Picus pushed to branch branch/release-pypy3.9-v7.x at PyPy / pypy


Commits:
0b2927f9 by Carl Friedrich Bolz-Tereick at 2022-02-18T12:30:58+01:00
#3674: fix co_firstlineno of the code object of class bodies with decorators

--HG--
branch : py3.9

- - - - -
92100c0e by Carl Friedrich Bolz-Tereick at 2022-02-19T11:19:14+01:00
#3673: I am not 100% sure this fixes the remaining trace hook problems, but it
has a pretty decent chance. approach is a bit different than CPython, but
CPython's approach has problems (broken in 3.9) and is very complicated.

the main problem is that for except Cls as name:
there is an artificial try: finally: block like this:

except Cls as name:
    try:
        ... # user-written code
    finally:
        name = None; del name

we never want to trace that finally, because it has the line number of the last
line in the user-written content of the except block. what I implement here is
to add a NOP in the artificial finally, and use that to detect this case and
not trigger a line trace event then.

--HG--
branch : py3.9

- - - - -
f76d2197 by Matti Picus at 2022-02-19T18:37:00+02:00
merge py3.9

--HG--
branch : release-pypy3.9-v7.x

- - - - -


5 changed files:

- pypy/interpreter/astcompiler/codegen.py
- pypy/interpreter/pycode.py
- pypy/interpreter/pyopcode.py
- pypy/interpreter/test/apptest_pyframe.py
- pypy/interpreter/test/test_compiler.py


View it on Heptapod: https://foss.heptapod.net/pypy/pypy/-/compare/67d7a2c0203b17bbdfba8451eded8951489b4ea9...f76d21971462e5892471e63c42a6779211b4edaf

-- 
View it on Heptapod: https://foss.heptapod.net/pypy/pypy/-/compare/67d7a2c0203b17bbdfba8451eded8951489b4ea9...f76d21971462e5892471e63c42a6779211b4edaf
You're receiving this email because of your account on foss.heptapod.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/pypy-commit/attachments/20220219/9707389b/attachment.html>


More information about the pypy-commit mailing list