mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
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.
This commit is contained in:
parent
4bd63f66cd
commit
a8fe4bbd6b
4 changed files with 20 additions and 56 deletions
|
|
@ -437,12 +437,8 @@ class TestEdgeCases(unittest.TestCase):
|
|||
sys.setprofile(bar)
|
||||
|
||||
sys.setprofile(A())
|
||||
with support.catch_unraisable_exception() as cm:
|
||||
sys.setprofile(foo)
|
||||
self.assertEqual(cm.unraisable.object, A.__del__)
|
||||
self.assertIsInstance(cm.unraisable.exc_value, RuntimeError)
|
||||
|
||||
self.assertEqual(sys.getprofile(), foo)
|
||||
sys.setprofile(foo)
|
||||
self.assertEqual(sys.getprofile(), bar)
|
||||
|
||||
|
||||
def test_same_object(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue