GH-91095: Specialize calls to normal Python classes. (GH-99331)

This commit is contained in:
Mark Shannon 2023-06-22 09:48:19 +01:00 committed by GitHub
parent c01da2896a
commit 04492cbc9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 511 additions and 189 deletions

View file

@ -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