Skip to content

Commit 1ee2f1c

Browse files
committed
Add test for tracing when quickening calls to Python classes.
1 parent 365fceb commit 1ee2f1c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Lib/test/test_sys_settrace.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,28 @@ def func():
15701570

15711571
self.run_and_compare(func, EXPECTED_EVENTS)
15721572

1573+
def test_correct_tracing_quickened_call_class_init(self):
1574+
1575+
class C:
1576+
def __init__(self):
1577+
self
1578+
1579+
def func():
1580+
C()
1581+
1582+
EXPECTED_EVENTS = [
1583+
(0, 'call'),
1584+
(1, 'line'),
1585+
(-3, 'call'),
1586+
(-2, 'line'),
1587+
(-2, 'return'),
1588+
(1, 'return')]
1589+
1590+
self.run_and_compare(func, EXPECTED_EVENTS)
1591+
# Quicken
1592+
for _ in range(100):
1593+
func()
1594+
self.run_and_compare(func, EXPECTED_EVENTS)
15731595

15741596
EVENT_NAMES = [
15751597
'call',

0 commit comments

Comments
 (0)