You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
A couple more 2.6 (and below) bugs fixed
* Detect "return None" inside if statement * another case of triple ==, ==, == scanner2.py: detect_structure: descriminate more on parent type
This commit is contained in:
@@ -774,7 +774,7 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
|
||||
def is_return_none(self, node):
|
||||
# Is there a better way?
|
||||
ret = (node == 'return_stmt'
|
||||
ret = (node in ('return_stmt', 'return_if_stmt')
|
||||
and node[0] == 'ret_expr'
|
||||
and node[0][0] == 'expr'
|
||||
and node[0][0][0] == 'LOAD_CONST'
|
||||
@@ -809,7 +809,7 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
self.prune()
|
||||
else:
|
||||
self.write(self.indent, 'return')
|
||||
if self.return_none or node != AST('return_stmt', [AST('ret_expr', [NONE]), Token('RETURN_END_IF')]):
|
||||
if self.return_none or not self.is_return_none(node):
|
||||
self.write(' ')
|
||||
self.preorder(node[0])
|
||||
self.println()
|
||||
|
Reference in New Issue
Block a user