summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2023-05-21 23:20:19 (GMT)
committerGitHub <noreply@github.com>2023-05-21 23:20:19 (GMT)
commitcd9748409aa877d6d9905730bf68f25cf7a6a723 (patch)
tree71c3424f290ac53b812cbcec7e0bc4a3491ab9df /Lib
parent64d1b44a5459605af3e8572d4febfde021315633 (diff)
downloadcpython-cd9748409aa877d6d9905730bf68f25cf7a6a723.zip
cpython-cd9748409aa877d6d9905730bf68f25cf7a6a723.tar.gz
cpython-cd9748409aa877d6d9905730bf68f25cf7a6a723.tar.bz2
gh-104686: Fix tracing for decorated classes (#104708)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_sys_settrace.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py
index 0571919..5603c3c 100644
--- a/Lib/test/test_sys_settrace.py
+++ b/Lib/test/test_sys_settrace.py
@@ -1524,6 +1524,52 @@ class TraceTestCase(unittest.TestCase):
(3, 'return'),
(1, 'return')])
+ def test_class_creation_with_decorator(self):
+ def func():
+ def decorator(arg):
+ def _dec(c):
+ return c
+ return _dec
+
+ @decorator(6)
+ @decorator(
+ len([8]),
+ )
+ class MyObject:
+ pass
+
+ self.run_and_compare(func, [
+ (0, 'call'),
+ (1, 'line'),
+ (6, 'line'),
+ (1, 'call'),
+ (2, 'line'),
+ (4, 'line'),
+ (4, 'return'),
+ (7, 'line'),
+ (8, 'line'),
+ (7, 'line'),
+ (1, 'call'),
+ (2, 'line'),
+ (4, 'line'),
+ (4, 'return'),
+ (10, 'line'),
+ (6, 'call'),
+ (6, 'line'),
+ (11, 'line'),
+ (11, 'return'),
+ (7, 'line'),
+ (2, 'call'),
+ (3, 'line'),
+ (3, 'return'),
+ (6, 'line'),
+ (2, 'call'),
+ (3, 'line'),
+ (3, 'return'),
+ (10, 'line'),
+ (10, 'return'),
+ ])
+
@support.cpython_only
def test_no_line_event_after_creating_generator(self):
# Spurious line events before call events only show up with C tracer