mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-10-07 18:23:42 +00:00
2.6. with fn()
This commit is contained in:
parent
ae980e4f64
commit
74c6b38fd8
BIN
test/bytecode_2.6/07_withstmt_fn.pyc
Normal file
BIN
test/bytecode_2.6/07_withstmt_fn.pyc
Normal file
Binary file not shown.
11
test/simple_source/stmts/07_withstmt_fn.py
Normal file
11
test/simple_source/stmts/07_withstmt_fn.py
Normal file
@ -0,0 +1,11 @@
|
||||
# Python 2.6 has a truly weird way of handling with here.
|
||||
# added rule for 2.6
|
||||
# setupwith ::= DUP_TOP LOAD_ATTR ROT_TWO LOAD_ATTR CALL_FUNCTION_0 POP_TOP
|
||||
|
||||
import sys
|
||||
from warnings import catch_warnings
|
||||
with catch_warnings():
|
||||
if sys.py3kwarning:
|
||||
sys.filterwarnings("ignore", ".*mimetools has been removed",
|
||||
DeprecationWarning)
|
||||
import mimetools
|
@ -85,6 +85,15 @@ class Python26Parser(Python2Parser):
|
||||
"""
|
||||
assert ::= assert_expr jmp_true LOAD_ASSERT RAISE_VARARGS_1 come_from_pop
|
||||
ifelsestmt ::= testexpr c_stmts_opt jf_pop else_suite COME_FROM
|
||||
|
||||
# This rule is contorted a little to make sutie_stmts_opt be the
|
||||
# forth argument for the semantic routines.
|
||||
withstmt ::= expr setupwith SETUP_FINALLY suite_stmts_opt
|
||||
POP_BLOCK LOAD_CONST COME_FROM WITH_CLEANUP END_FINALLY
|
||||
|
||||
# This is truly weird. 2.7 does this (not including POP_TOP) with
|
||||
# opcode SETUP_WITH
|
||||
setupwith ::= DUP_TOP LOAD_ATTR ROT_TWO LOAD_ATTR CALL_FUNCTION_0 POP_TOP
|
||||
"""
|
||||
|
||||
def p_comp26(self, args):
|
||||
|
Loading…
Reference in New Issue
Block a user