summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-09-08 16:16:48 (GMT)
committerGitHub <noreply@github.com>2022-09-08 16:16:48 (GMT)
commitaa3b4cf779b3dddb84e094879b91703354910d8c (patch)
tree3f0ddce65f690bdad6987db96e2f1353cb22d32f /Lib
parentb9634ac776c24bc4d4a57859d884a94cdfe16043 (diff)
downloadcpython-aa3b4cf779b3dddb84e094879b91703354910d8c.zip
cpython-aa3b4cf779b3dddb84e094879b91703354910d8c.tar.gz
cpython-aa3b4cf779b3dddb84e094879b91703354910d8c.tar.bz2
GH-96636: Remove all uses of NOTRACE_DISPATCH (GH-96643)
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_dynamic.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/Lib/test/test_dynamic.py b/Lib/test/test_dynamic.py
index e896fc7..25544de 100644
--- a/Lib/test/test_dynamic.py
+++ b/Lib/test/test_dynamic.py
@@ -149,5 +149,48 @@ class RebindBuiltinsTests(unittest.TestCase):
for _ in range(30):
self.assertEqual(sum_func(), expected)
+
+class TestTracing(unittest.TestCase):
+
+ def setUp(self):
+ self.addCleanup(sys.settrace, sys.gettrace())
+ sys.settrace(None)
+
+ def test_after_specialization(self):
+
+ def trace(frame, event, arg):
+ return trace
+
+ turn_on_trace = False
+
+ class C:
+ def __init__(self, x):
+ self.x = x
+ def __del__(self):
+ if turn_on_trace:
+ sys.settrace(trace)
+
+ def f():
+ # LOAD_GLOBAL[_BUILTIN] immediately follows the call to C.__del__
+ C(0).x, len
+
+ def g():
+ # BINARY_SUSCR[_LIST_INT] immediately follows the call to C.__del__
+ [0][C(0).x]
+
+ def h():
+ # BINARY_OP[_ADD_INT] immediately follows the call to C.__del__
+ 0 + C(0).x
+
+ for func in (f, g, h):
+ with self.subTest(func.__name__):
+ for _ in range(58):
+ func()
+ turn_on_trace = True
+ func()
+ sys.settrace(None)
+ turn_on_trace = False
+
+
if __name__ == "__main__":
unittest.main()