diff options
author | Mark Shannon <mark@hotpy.org> | 2023-06-22 09:48:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-22 09:48:19 +0100 |
commit | 04492cbc9aa45ac2c12d22083c406a0364c39f5b (patch) | |
tree | 4eb26dc0dca29519cabe1086aec523bc29e8f4b5 /Lib/test/test_sys_settrace.py | |
parent | c01da2896ab92ba7193bcd6ae56908c5c7277e75 (diff) | |
download | cpython-04492cbc9aa45ac2c12d22083c406a0364c39f5b.tar.gz cpython-04492cbc9aa45ac2c12d22083c406a0364c39f5b.zip |
GH-91095: Specialize calls to normal Python classes. (GH-99331)
Diffstat (limited to 'Lib/test/test_sys_settrace.py')
-rw-r--r-- | Lib/test/test_sys_settrace.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index 5603c3cdbf3..4462b5c712d 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -1614,8 +1614,30 @@ class TraceTestCase(unittest.TestCase): self.run_and_compare(func, EXPECTED_EVENTS) - def test_settrace_error(self): + def test_correct_tracing_quickened_call_class_init(self): + + class C: + def __init__(self): + self + + def func(): + C() + EXPECTED_EVENTS = [ + (0, 'call'), + (1, 'line'), + (-3, 'call'), + (-2, 'line'), + (-2, 'return'), + (1, 'return')] + + self.run_and_compare(func, EXPECTED_EVENTS) + # Quicken + for _ in range(100): + func() + self.run_and_compare(func, EXPECTED_EVENTS) + + def test_settrace_error(self): raised = False def error_once(frame, event, arg): nonlocal raised |