You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Merge branch 'master' into python-3.3-to-3.5
This commit is contained in:
@@ -1255,13 +1255,23 @@ class SourceWalker(GenericASTTraversal, NonterminalActions, ComprehensionMixin):
|
||||
if tokens[-1].kind in ("RETURN_VALUE", "RETURN_VALUE_LAMBDA"):
|
||||
# Python 3.4's classes can add a "return None" which is
|
||||
# invalid syntax.
|
||||
if tokens[-2].kind == "LOAD_CONST":
|
||||
if is_top_level_module or tokens[-2].pattr is None:
|
||||
load_const = tokens[-2]
|
||||
# We should have:
|
||||
# LOAD_CONST None
|
||||
# with *no* line number associated the token.
|
||||
# A line number on the token or a non-None
|
||||
# token value a token based on user source
|
||||
# text.
|
||||
if (
|
||||
load_const.kind == "LOAD_CONST"
|
||||
and load_const.linestart is None
|
||||
and load_const.attr is None
|
||||
or is_top_level_module
|
||||
):
|
||||
# Delete LOAD_CONST (None) RETURN_VALUE
|
||||
del tokens[-2:]
|
||||
else:
|
||||
tokens.append(Token("RETURN_LAST"))
|
||||
else:
|
||||
tokens.append(Token("RETURN_LAST"))
|
||||
if len(tokens) == 0:
|
||||
return PASS
|
||||
|
||||
|
Reference in New Issue
Block a user