You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 08:49:51 +08:00
Python 2.7 "return None" bug
Same as 2.3-2.6 "return None".
This commit is contained in:
@@ -774,17 +774,19 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
|
||||
def is_return_none(self, node):
|
||||
# Is there a better way?
|
||||
ret = (node == 'return_stmt'
|
||||
and node[0] == 'ret_expr'
|
||||
and node[0][0] == 'expr'
|
||||
and node[0][0][0] == 'LOAD_CONST'
|
||||
and node[0][0][0].pattr is None)
|
||||
if self.version <= 2.6:
|
||||
return (node == 'return_stmt'
|
||||
and node[0] == 'ret_expr'
|
||||
and node[0][0] == 'expr'
|
||||
and node[0][0][0] == 'LOAD_CONST'
|
||||
and node[0][0][0].pattr is None)
|
||||
return ret
|
||||
else:
|
||||
# FIXME: should the AST expression be folded into
|
||||
# the global RETURN_NONE constant?
|
||||
node == AST('return_stmt',
|
||||
[AST('ret_expr', [NONE]), Token('RETURN_VALUE')])
|
||||
return (ret or
|
||||
node == AST('return_stmt',
|
||||
[AST('ret_expr', [NONE]), Token('RETURN_VALUE')]))
|
||||
|
||||
def n_return_stmt(self, node):
|
||||
if self.params['isLambda']:
|
||||
|
Reference in New Issue
Block a user