diff options
author | Mark Shannon <mark@hotpy.org> | 2023-06-22 08:48:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-22 08:48:19 (GMT) |
commit | 04492cbc9aa45ac2c12d22083c406a0364c39f5b (patch) | |
tree | 4eb26dc0dca29519cabe1086aec523bc29e8f4b5 /Lib/test | |
parent | c01da2896ab92ba7193bcd6ae56908c5c7277e75 (diff) | |
download | cpython-04492cbc9aa45ac2c12d22083c406a0364c39f5b.zip cpython-04492cbc9aa45ac2c12d22083c406a0364c39f5b.tar.gz cpython-04492cbc9aa45ac2c12d22083c406a0364c39f5b.tar.bz2 |
GH-91095: Specialize calls to normal Python classes. (GH-99331)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_sys.py | 2 | ||||
-rw-r--r-- | Lib/test/test_sys_settrace.py | 24 |
2 files changed, 24 insertions, 2 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index d81501f..37f75ad 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -1557,7 +1557,7 @@ class SizeofTest(unittest.TestCase): '10P' # PySequenceMethods '2P' # PyBufferProcs '6P' - '1PI' # Specializer cache + '1PIP' # Specializer cache ) class newstyleclass(object): pass # Separate block for PyDictKeysObject with 8 keys and 5 entries diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index 5603c3c..4462b5c 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 |