You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Fix a 3.6 try/except-as bug
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -18,3 +18,16 @@ def getvalue1(self):
|
||||
finally:
|
||||
pass
|
||||
return 2
|
||||
|
||||
# From Python 3.6 asynchat.py
|
||||
# Bug is handling as why in the face of a return.
|
||||
# uncompyle6 shows removal of "why" after the return.
|
||||
def handle_read(self):
|
||||
try:
|
||||
data = 5
|
||||
except ZeroDivisionError:
|
||||
return
|
||||
except OSError as why:
|
||||
return why
|
||||
|
||||
return data
|
||||
|
@@ -5,3 +5,8 @@ def _85encode(foldnuls, words):
|
||||
return ['z' if foldnuls and word
|
||||
else 'y'
|
||||
for word in words]
|
||||
|
||||
# From Python 3.6 enum.py
|
||||
|
||||
def __new__(metacls, cls, bases, classdict):
|
||||
{k: classdict[k] for k in classdict._member_names}
|
||||
|
@@ -240,10 +240,10 @@ class Python3Parser(PythonParser):
|
||||
except_suite ::= returns
|
||||
|
||||
except_cond1 ::= DUP_TOP expr COMPARE_OP
|
||||
jmp_false POP_TOP POP_TOP POP_TOP
|
||||
jmp_false POP_TOP POP_TOP POP_TOP
|
||||
|
||||
except_cond2 ::= DUP_TOP expr COMPARE_OP
|
||||
jmp_false POP_TOP store POP_TOP
|
||||
jmp_false POP_TOP store POP_TOP
|
||||
|
||||
except ::= POP_TOP POP_TOP POP_TOP c_stmts_opt POP_EXCEPT _jump
|
||||
except ::= POP_TOP POP_TOP POP_TOP returns
|
||||
|
@@ -33,9 +33,12 @@ class Python36Parser(Python35Parser):
|
||||
"""
|
||||
sstmt ::= sstmt RETURN_LAST
|
||||
|
||||
# 3.6 redoes how return_closure works
|
||||
# 3.6 redoes how return_closure works. FIXME: Isolate to LOAD_CLOSURE
|
||||
return_closure ::= LOAD_CLOSURE DUP_TOP STORE_NAME RETURN_VALUE RETURN_LAST
|
||||
|
||||
# Is there something general going on here? FIXME: Isolate to LOAD_DICTCOMP
|
||||
dict_comp ::= load_closure LOAD_DICTCOMP LOAD_CONST MAKE_FUNCTION_8 expr GET_ITER CALL_FUNCTION_1
|
||||
|
||||
stmt ::= conditional_lambda
|
||||
conditional_lambda ::= expr jmp_false expr return_if_lambda
|
||||
return_stmt_lambda LAMBDA_MARKER
|
||||
@@ -78,6 +81,8 @@ class Python36Parser(Python35Parser):
|
||||
COME_FROM_FINALLY suite_stmts
|
||||
tryfinally36 ::= SETUP_FINALLY returns
|
||||
COME_FROM_FINALLY suite_stmts_opt END_FINALLY
|
||||
except_suite_finalize ::= SETUP_FINALLY returns
|
||||
COME_FROM_FINALLY suite_stmts_opt END_FINALLY _jump
|
||||
"""
|
||||
|
||||
def customize_grammar_rules(self, tokens, customize):
|
||||
|
Reference in New Issue
Block a user