]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-144446: Fix some frame object thread-safety issues (gh-144479)
authorSam Gross <colesbury@gmail.com>
Fri, 6 Feb 2026 14:43:36 +0000 (09:43 -0500)
committerGitHub <noreply@github.com>
Fri, 6 Feb 2026 14:43:36 +0000 (09:43 -0500)
commit5bb3bbb9c6a7c9043a04d0cc2e82c83747040788
tree465e9b515a569298c69cc1358c5ff9fe82d1a7ce
parent45d4a347205ede4568d912edf820e4de80213392
gh-144446: Fix some frame object thread-safety issues (gh-144479)

Fix thread-safety issues when accessing frame attributes while another
thread is executing the frame:

- Add critical section to frame_repr() to prevent races when accessing
  the frame's code object and line number

- Add _Py_NO_SANITIZE_THREAD to PyUnstable_InterpreterFrame_GetLasti()
  to allow intentional racy reads of instr_ptr.

- Fix take_ownership() to not write to the original frame's f_executable
Lib/test/test_free_threading/test_frame.py [new file with mode: 0644]
Misc/NEWS.d/next/Core_and_Builtins/2026-02-03-17-08-13.gh-issue-144446.db5619.rst [new file with mode: 0644]
Objects/frameobject.c
Python/frame.c