summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/_opcode_metadata.py1
-rw-r--r--Lib/opcode.py1
-rw-r--r--Lib/test/test_sys.py2
-rw-r--r--Lib/test/test_sys_settrace.py24
4 files changed, 26 insertions, 2 deletions
diff --git a/Lib/_opcode_metadata.py b/Lib/_opcode_metadata.py
index 92ed403..c0a6825 100644
--- a/Lib/_opcode_metadata.py
+++ b/Lib/_opcode_metadata.py
@@ -85,6 +85,7 @@ _specializations = {
"CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS",
"CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS",
"CALL_NO_KW_METHOD_DESCRIPTOR_FAST",
+ "CALL_NO_KW_ALLOC_AND_ENTER_INIT",
],
}
diff --git a/Lib/opcode.py b/Lib/opcode.py
index ed01d2c..392464d 100644
--- a/Lib/opcode.py
+++ b/Lib/opcode.py
@@ -97,6 +97,7 @@ def_op('UNARY_NEGATIVE', 11)
def_op('UNARY_NOT', 12)
def_op('UNARY_INVERT', 15)
+def_op('EXIT_INIT_CHECK', 16)
# We reserve 17 as it is the initial value for the specializing counter
# This helps us catch cases where we attempt to execute a cache.
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