You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Binary file not shown.
@@ -14,3 +14,14 @@ def __init__(self, defaults=None, dict_type=_default_dict,
|
|||||||
# Python 3.6+ replaces CALL_FUNCTION_VAR_KW with CALL_FUNCTION_EX
|
# Python 3.6+ replaces CALL_FUNCTION_VAR_KW with CALL_FUNCTION_EX
|
||||||
def deferred(*columns, **kw):
|
def deferred(*columns, **kw):
|
||||||
return ColumnProperty(deferred=True, *columns, **kw)
|
return ColumnProperty(deferred=True, *columns, **kw)
|
||||||
|
|
||||||
|
|
||||||
|
# From sqlalchemy/sql/selectable.py
|
||||||
|
class GenerativeSelect():
|
||||||
|
def __init__(self,
|
||||||
|
ClauseList,
|
||||||
|
util,
|
||||||
|
order_by=None):
|
||||||
|
self._order_by_clause = ClauseList(
|
||||||
|
*util.to_list(order_by),
|
||||||
|
_literal_as_text=5)
|
||||||
|
@@ -482,14 +482,17 @@ class Python3Parser(PythonParser):
|
|||||||
|
|
||||||
token.type = self.call_fn_name(token)
|
token.type = self.call_fn_name(token)
|
||||||
uniq_param = args_kw + args_pos
|
uniq_param = args_kw + args_pos
|
||||||
if self.version == 3.5 and opname.startswith('CALL_FUNCTION_VAR_KW'):
|
if self.version == 3.5 and opname.startswith('CALL_FUNCTION_VAR'):
|
||||||
# Python 3.5 changes the stack position of where * args, the
|
# Python 3.5 changes the stack position of where * args, the
|
||||||
# first LOAD_FAST, below are located.
|
# first LOAD_FAST, below are located.
|
||||||
# Python 3.6+ replaces CALL_FUNCTION_VAR_KW with CALL_FUNCTION_EX
|
# Python 3.6+ replaces CALL_FUNCTION_VAR_KW with CALL_FUNCTION_EX
|
||||||
rule = ('call_function ::= LOAD_GLOBAL LOAD_FAST ' +
|
if opname.endswith('KW'):
|
||||||
|
kw = 'LOAD_FAST '
|
||||||
|
else:
|
||||||
|
kw = ''
|
||||||
|
rule = ('call_function ::= expr expr ' +
|
||||||
('pos_arg ' * args_pos) +
|
('pos_arg ' * args_pos) +
|
||||||
('kwarg ' * args_kw) + 'LOAD_FAST '
|
('kwarg ' * args_kw) + kw + token.type)
|
||||||
+ token.type)
|
|
||||||
self.add_unique_rule(rule, token.type, uniq_param, customize)
|
self.add_unique_rule(rule, token.type, uniq_param, customize)
|
||||||
|
|
||||||
rule = ('call_function ::= expr ' +
|
rule = ('call_function ::= expr ' +
|
||||||
|
@@ -1771,16 +1771,31 @@ class SourceWalker(GenericASTTraversal, object):
|
|||||||
str = '%c(%C, '
|
str = '%c(%C, '
|
||||||
p2 = (1, -2, ', ')
|
p2 = (1, -2, ', ')
|
||||||
if op == 'CALL_FUNCTION_VAR':
|
if op == 'CALL_FUNCTION_VAR':
|
||||||
str += '*%c)'
|
# Python 3.5 only puts optional args (the VAR part)
|
||||||
|
# lowest down the stack
|
||||||
|
if self.version == 3.5:
|
||||||
|
if str == '%c(%C, ':
|
||||||
|
str = '%c(*%C, %c)'
|
||||||
|
else:
|
||||||
|
str += '*%c)'
|
||||||
entry = (str, 0, p2, -2)
|
entry = (str, 0, p2, -2)
|
||||||
elif op == 'CALL_FUNCTION_KW':
|
elif op == 'CALL_FUNCTION_KW':
|
||||||
str += '**%c)'
|
str += '**%c)'
|
||||||
entry = (str, 0, p2, -2)
|
entry = (str, 0, p2, -2)
|
||||||
else:
|
elif op == 'CALL_FUNCTION_VAR_KW':
|
||||||
str += '*%c, **%c)'
|
str += '*%c, **%c)'
|
||||||
if p2[2]: p2 = (1, -3, ', ')
|
# Python 3.5 only puts optional args (the VAR part)
|
||||||
entry = (str, 0, p2, -3, -2)
|
# lowest down the stack
|
||||||
|
if self.version == 3.5:
|
||||||
|
if p2[2]: p2 = (2, -2, ', ')
|
||||||
|
entry = (str, 0, p2, 1, -2)
|
||||||
|
else:
|
||||||
|
if p2[2]: p2 = (1, -3, ', ')
|
||||||
|
entry = (str, 0, p2, -3, -2)
|
||||||
pass
|
pass
|
||||||
|
else:
|
||||||
|
assert False, "Unhandled CALL_FUNCTION %s" % op
|
||||||
|
|
||||||
TABLE_R[k] = entry
|
TABLE_R[k] = entry
|
||||||
pass
|
pass
|
||||||
# handled by n_mapexpr:
|
# handled by n_mapexpr:
|
||||||
|
Reference in New Issue
Block a user