summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_dis.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2020-12-02 13:31:40 (GMT)
committerGitHub <noreply@github.com>2020-12-02 13:31:40 (GMT)
commit5977a7989d49c3e095c7659a58267d87a17b12b1 (patch)
treead939d53e137521f2dd7f9c0bab029c5c85eb781 /Lib/test/test_dis.py
parent4e7a69bdb63a104587759d7784124492dcdd496e (diff)
downloadcpython-5977a7989d49c3e095c7659a58267d87a17b12b1.zip
cpython-5977a7989d49c3e095c7659a58267d87a17b12b1.tar.gz
cpython-5977a7989d49c3e095c7659a58267d87a17b12b1.tar.bz2
bpo-42246: Make sure that line number is correct after a return, as required by PEP 626 (GH-23495)
Make sure that line number is correct after a return, as defined by PEP 626.
Diffstat (limited to 'Lib/test/test_dis.py')
-rw-r--r--Lib/test/test_dis.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py
index 9cd11d3..d0743d6 100644
--- a/Lib/test/test_dis.py
+++ b/Lib/test/test_dis.py
@@ -131,12 +131,14 @@ dis_bug708901 = """\
12 STORE_FAST 0 (res)
%3d 14 JUMP_ABSOLUTE 10
- >> 16 LOAD_CONST 0 (None)
+
+%3d >> 16 LOAD_CONST 0 (None)
18 RETURN_VALUE
""" % (bug708901.__code__.co_firstlineno + 1,
bug708901.__code__.co_firstlineno + 2,
bug708901.__code__.co_firstlineno + 1,
- bug708901.__code__.co_firstlineno + 3)
+ bug708901.__code__.co_firstlineno + 3,
+ bug708901.__code__.co_firstlineno + 1)
def bug1333982(x=[]):
@@ -295,13 +297,15 @@ dis_traceback = """\
52 STORE_FAST 0 (e)
54 DELETE_FAST 0 (e)
56 RERAISE
- >> 58 RERAISE
+
+%3d >> 58 RERAISE
""" % (TRACEBACK_CODE.co_firstlineno + 1,
TRACEBACK_CODE.co_firstlineno + 2,
TRACEBACK_CODE.co_firstlineno + 5,
TRACEBACK_CODE.co_firstlineno + 3,
TRACEBACK_CODE.co_firstlineno + 4,
- TRACEBACK_CODE.co_firstlineno + 5)
+ TRACEBACK_CODE.co_firstlineno + 5,
+ TRACEBACK_CODE.co_firstlineno + 3)
def _fstring(a, b, c, d):
return f'{a} {b:4} {c!r} {d!r:4}'