benfred / py-spy

Sampling profiler for Python programs
MIT License
12.13k stars 401 forks source link

fix line number for python 3.12 #666

Open penguin-wwy opened 1 month ago

penguin-wwy commented 1 month 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)