version=None in deparse_code() uses sys.version...

(the current interpreter version) as the version to decompile.

Fixes #159.
This commit is contained in:
rocky
2018-02-21 17:40:43 -05:00
parent ee89b5decd
commit 859ce2206d

View File

@@ -2613,10 +2613,15 @@ def deparse_code(version, co, out=sys.stdout, showasm=None, showast=False,
showgrammar=False, code_objects={}, compile_mode='exec',
is_pypy=False, walker=SourceWalker):
"""
ingests and deparses a given code block 'co'
ingests and deparses a given code block 'co'. If version is None,
we will use the current Python interpreter version.
"""
assert iscode(co)
if version == None:
version = float(sys.version[0:3])
# store final output stream for case of error
scanner = get_scanner(version, is_pypy=is_pypy)