mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
GH-91095: Specialize calls to normal Python classes. (GH-99331)
This commit is contained in:
parent
c01da2896a
commit
04492cbc9a
20 changed files with 511 additions and 189 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue