]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-98257: Make _PyEval_SetTrace() reentrant (#98258)
authorVictor Stinner <vstinner@python.org>
Wed, 19 Oct 2022 22:31:47 +0000 (00:31 +0200)
committerGitHub <noreply@github.com>
Wed, 19 Oct 2022 22:31:47 +0000 (00:31 +0200)
commita8fe4bbd6b78517f640e25697338b9448c4675c1
treeb661e5d047c6a0a552c5ccf132cad0df636ba4e1
parent4bd63f66cd4f6e8d549f88ae0f4b0106d522b6bb
gh-98257: Make _PyEval_SetTrace() reentrant (#98258)

Make sys.setprofile() and sys.settrace() functions reentrant.  They
can no long fail with: RuntimeError("Cannot install a trace function
while another trace function is being installed").

Make _PyEval_SetTrace() and _PyEval_SetProfile() functions reentrant,
rather than detecting and rejecting reentrant calls. Only delete the
reference to function arguments once the new function is fully set,
when a reentrant call is safe. Call also _PySys_Audit() earlier.
Lib/test/test_sys_setprofile.py
Lib/test/test_sys_settrace.py
Misc/NEWS.d/next/Library/2022-10-14-12-29-05.gh-issue-98257.aMSMs2.rst [new file with mode: 0644]
Python/ceval.c