summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sys_settrace.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2020-11-12 09:43:29 (GMT)
committerGitHub <noreply@github.com>2020-11-12 09:43:29 (GMT)
commit877df851c3ecdb55306840e247596e7b7805a60a (patch)
treeec00c0af84f9f228d78e23e8c8b38201129f8fae /Lib/test/test_sys_settrace.py
parentcda99b4022daa08ac74b0420e9903cce883d91c6 (diff)
downloadcpython-877df851c3ecdb55306840e247596e7b7805a60a.zip
cpython-877df851c3ecdb55306840e247596e7b7805a60a.tar.gz
cpython-877df851c3ecdb55306840e247596e7b7805a60a.tar.bz2
bpo-42246: Partial implementation of PEP 626. (GH-23113)
* Implement new line number table format, as defined in PEP 626.
Diffstat (limited to 'Lib/test/test_sys_settrace.py')
-rw-r--r--Lib/test/test_sys_settrace.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py
index dd4418d..66b1b36 100644
--- a/Lib/test/test_sys_settrace.py
+++ b/Lib/test/test_sys_settrace.py
@@ -220,8 +220,7 @@ ireturn_example.events = [(0, 'call'),
(2, 'line'),
(3, 'line'),
(4, 'line'),
- (6, 'line'),
- (6, 'return')]
+ (4, 'return')]
# Tight loop with while(1) example (SF #765624)
def tightloop_example():
@@ -602,6 +601,17 @@ class TraceTestCase(unittest.TestCase):
self.compare_events(doit_async.__code__.co_firstlineno,
tracer.events, events)
+ def test_21_repeated_pass(self):
+ def func():
+ pass
+ pass
+
+ self.run_and_compare(func,
+ [(0, 'call'),
+ (1, 'line'),
+ (2, 'line'),
+ (2, 'return')])
+
def test_loop_in_try_except(self):
# https://bugs.python.org/issue41670
@@ -766,7 +776,7 @@ class JumpTracer:
if (self.firstLine is None and frame.f_code == self.code and
event == 'line'):
self.firstLine = frame.f_lineno - 1
- if (event == self.event and self.firstLine and
+ if (event == self.event and self.firstLine is not None and
frame.f_lineno == self.firstLine + self.jumpFrom):
f = frame
while f is not None and f.f_code != self.code:
@@ -1540,7 +1550,7 @@ output.append(4)
""", "<fake module>", "exec")
class fake_function:
__code__ = code
- tracer = JumpTracer(fake_function, 2, 0)
+ tracer = JumpTracer(fake_function, 4, 1)
sys.settrace(tracer.trace)
namespace = {"output": []}
exec(code, namespace)