You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Fix condition sense in except_handler.py reduction
This commit is contained in:
@@ -2,13 +2,15 @@
|
|||||||
|
|
||||||
def except_handler(self, lhs, n, rule, ast, tokens, first, last):
|
def except_handler(self, lhs, n, rule, ast, tokens, first, last):
|
||||||
end_token = tokens[last-1]
|
end_token = tokens[last-1]
|
||||||
|
|
||||||
|
# print("XXX", first, last)
|
||||||
# for t in range(first, last):
|
# for t in range(first, last):
|
||||||
# print(tokens[t])
|
# print(tokens[t])
|
||||||
# print("=" * 30)
|
# print("=" * 30)
|
||||||
|
|
||||||
# FIXME: Figure out why this doesn't work on
|
# FIXME: Figure out why this doesn't work on
|
||||||
# bytecode-1.4/anydbm.pyc
|
# bytecode-1.4/anydbm.pyc
|
||||||
if self.version != 1.4:
|
if self.version == 1.4:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Make sure come froms all come from within "except_handler".
|
# Make sure come froms all come from within "except_handler".
|
||||||
|
@@ -587,8 +587,7 @@ class SourceWalker(GenericASTTraversal, object):
|
|||||||
if n == "LOAD_CONST" and repr(n.pattr)[0] == "-":
|
if n == "LOAD_CONST" and repr(n.pattr)[0] == "-":
|
||||||
self.prec = 6
|
self.prec = 6
|
||||||
|
|
||||||
# print(n.kind, p, "<", self.prec)
|
# print("XXX", n.kind, p, "<", self.prec)
|
||||||
# print(self.f.getvalue())
|
|
||||||
|
|
||||||
if p < self.prec:
|
if p < self.prec:
|
||||||
self.write("(")
|
self.write("(")
|
||||||
@@ -604,7 +603,6 @@ class SourceWalker(GenericASTTraversal, object):
|
|||||||
# If expr is yield we want parens.
|
# If expr is yield we want parens.
|
||||||
self.prec = PRECEDENCE["yield"] - 1
|
self.prec = PRECEDENCE["yield"] - 1
|
||||||
self.n_expr(node[0])
|
self.n_expr(node[0])
|
||||||
p = self.prec
|
|
||||||
else:
|
else:
|
||||||
self.n_expr(node)
|
self.n_expr(node)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user