benfred / py-spy

Sampling profiler for Python programs
MIT License
12.89k stars 431 forks source link

fix line number for python 3.12 #666

Closed penguin-wwy closed 1 month ago

penguin-wwy commented 6 months ago

The linetable for 3.12 and 3.11 have the same structure, refactored to a common macro.

Current py-spy dump output on the tests/scripts/longsleep.py test case:

Process 1721748: python tests/scripts/longsleep.py
Python v3.12.1 (/data/home/self/.pyenv/versions/3.12.1/bin/python3.12)

Thread 1721748 (idle)
    longsleep (longsleep.py:5)
    <module> (longsleep.py:9)
    <interpreter trampoline> (<shim>:1)