summaryrefslogtreecommitdiff
path: root/Lib/test/test_dis.py
diff options
context:
space:
mode:
authorYurii Karabas <1998uriyyo@gmail.com>2020-12-04 17:20:53 +0200
committerGitHub <noreply@github.com>2020-12-04 15:20:53 +0000
commitf24b8101a01fa98b1e3ec042ba896aeb4c24d4bc (patch)
tree0609fe4244b29ddceb20c1d0dbb23fb2e43a377c /Lib/test/test_dis.py
parentdb68544122f5a0c7b80f69c0e643049efa6699c6 (diff)
downloadcpython-git-f24b8101a01fa98b1e3ec042ba896aeb4c24d4bc.tar.gz
bpo-42562: Fix issue when dis failed to parse function that has no line numbers (GH-23632)
Fix issue when dis failed to parse function that has only annotations
Diffstat (limited to 'Lib/test/test_dis.py')
-rw-r--r--Lib/test/test_dis.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py
index d0743d62e3..56d8771518 100644
--- a/Lib/test/test_dis.py
+++ b/Lib/test/test_dis.py
@@ -166,6 +166,20 @@ dis_bug1333982 = """\
bug1333982.__code__.co_firstlineno + 2,
bug1333982.__code__.co_firstlineno + 1)
+
+def bug42562():
+ pass
+
+
+# Set line number for 'pass' to None
+bug42562.__code__ = bug42562.__code__.replace(co_linetable=b'\x04\x80\xff\x80')
+
+
+dis_bug42562 = """\
+ 0 LOAD_CONST 0 (None)
+ 2 RETURN_VALUE
+"""
+
_BIG_LINENO_FORMAT = """\
%3d 0 LOAD_GLOBAL 0 (spam)
2 POP_TOP
@@ -520,6 +534,9 @@ class DisTests(unittest.TestCase):
self.do_disassembly_test(bug1333982, dis_bug1333982)
+ def test_bug_42562(self):
+ self.do_disassembly_test(bug42562, dis_bug42562)
+
def test_big_linenos(self):
def func(count):
namespace = {}