]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-140815: Fix faulthandler for invalid/freed frame (#140921) (#140985)
authorVictor Stinner <vstinner@python.org>
Wed, 5 Nov 2025 17:39:28 +0000 (18:39 +0100)
committerGitHub <noreply@github.com>
Wed, 5 Nov 2025 17:39:28 +0000 (18:39 +0100)
commit43882c7c4e1ec9ccd4ce32eb6a4c5a3f47c270b7
tree51ef1a8908e7867e10eb5a0e47c588e7c007adf2
parent7ac9048ce94b829ce9c7232c374880f5c1feea34
[3.13] gh-140815: Fix faulthandler for invalid/freed frame (#140921) (#140985)

gh-140815: Fix faulthandler for invalid/freed frame (#140921)

faulthandler now detects if a frame or a code object is invalid or
freed.

Add helper functions:

* _PyCode_SafeAddr2Line()
* _PyFrame_SafeGetCode()
* _PyFrame_SafeGetLasti()

_PyMem_IsPtrFreed() now detects pointers in [-0xff, 0xff] range
as freed.

(cherry picked from commit a84181c31bfc45a1d6bcb1296bd298ad612c54d0)
Include/internal/pycore_code.h
Include/internal/pycore_frame.h
Include/internal/pycore_pymem.h
Misc/NEWS.d/next/Library/2025-11-02-19-23-32.gh-issue-140815.McEG-T.rst [new file with mode: 0644]
Objects/codeobject.c
Python/traceback.c