You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
2.7 bug confusing "or" with "if" and "assert"
This commit is contained in:
@@ -7,3 +7,11 @@ def __call__(arg, dest):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
__call__('spam', __file__)
|
__call__('spam', __file__)
|
||||||
|
|
||||||
|
# From python 2.7.14 lib2to3/refactor.py
|
||||||
|
# Bug was mangling assert turning if into "or"
|
||||||
|
def refactor_doctest(clipped, new):
|
||||||
|
assert clipped, clipped
|
||||||
|
if not new:
|
||||||
|
new += u"\n"
|
||||||
|
return
|
||||||
|
@@ -538,7 +538,7 @@ class Python2Parser(PythonParser):
|
|||||||
# if lhs == 'while1elsestmt':
|
# if lhs == 'while1elsestmt':
|
||||||
# from trepan.api import debug; debug()
|
# from trepan.api import debug; debug()
|
||||||
|
|
||||||
if lhs in ('aug_assign1', 'aug_assign2') and ast[0] and ast[0][0] == 'and':
|
if lhs in ('aug_assign1', 'aug_assign2') and ast[0] and ast[0][0] in ('and', 'or'):
|
||||||
return True
|
return True
|
||||||
if rule == ('or', ('expr', 'jmp_true', 'expr', '\\e_come_from_opt')):
|
if rule == ('or', ('expr', 'jmp_true', 'expr', '\\e_come_from_opt')):
|
||||||
expr2 = ast[2]
|
expr2 = ast[2]
|
||||||
|
Reference in New Issue
Block a user