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
This commit is contained in:
Yurii Karabas 2020-12-04 17:20:53 +02:00 committed by GitHub
parent db68544122
commit f24b8101a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View file

@ -384,7 +384,7 @@ def _disassemble_bytes(code, lasti=-1, varnames=None, names=None,
constants=None, cells=None, linestarts=None,
*, file=None, line_offset=0):
# Omit the line number column entirely if we have no line number info
show_lineno = linestarts is not None
show_lineno = bool(linestarts)
if show_lineno:
maxlineno = max(linestarts.values()) + line_offset
if maxlineno >= 1000: