You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
3.5 *() arg without further args
This commit is contained in:
Binary file not shown.
@@ -21,3 +21,10 @@ def Time2Internaldate(date_time):
|
||||
return datetime(*date_time[:6], tzinfo=timezone(delta))
|
||||
|
||||
assert Time2Internaldate(time.localtime())
|
||||
|
||||
# From 3.5.5 tkinter/dialog.py
|
||||
def test_varargs0_ext(self):
|
||||
try:
|
||||
{}.__contains__(*())
|
||||
except TypeError:
|
||||
pass
|
||||
|
@@ -210,7 +210,6 @@ class Python35Parser(Python34Parser):
|
||||
self.add_unique_rule(rule, token.kind, uniq_param, customize)
|
||||
self.add_unique_rule('expr ::= async_call', token.kind, uniq_param, customize)
|
||||
|
||||
uniq_param = args_kw + args_pos
|
||||
if opname.startswith('CALL_FUNCTION_VAR'):
|
||||
# Python 3.5 changes the stack position of *args. KW args come
|
||||
# after *args.
|
||||
@@ -226,7 +225,10 @@ class Python35Parser(Python34Parser):
|
||||
rule = ('call ::= expr expr ' +
|
||||
('pos_arg ' * args_pos) +
|
||||
('kwarg ' * args_kw) + kw + token.kind)
|
||||
self.add_unique_rule(rule, token.kind, uniq_param, customize)
|
||||
|
||||
# Note: semantic actions make use of the fact of wheter "args_pos"
|
||||
# zero or not in creating a template rule.
|
||||
self.add_unique_rule(rule, token.kind, args_pos, customize)
|
||||
else:
|
||||
super(Python35Parser, self).custom_classfunc_rule(opname, token, customize,
|
||||
seen_LOAD_BUILD_CLASS,
|
||||
|
@@ -313,7 +313,10 @@ def customize_for_version(self, is_pypy, version):
|
||||
template = ('*%P)', (0, len(args_node)-1, ', *', 100))
|
||||
self.template_engine(template, args_node)
|
||||
else:
|
||||
template = ('*%c, %C)', 1, (2, -1, ', '))
|
||||
if len(node) > 3:
|
||||
template = ('*%c, %C)', 1, (2, -1, ', '))
|
||||
else:
|
||||
template = ('*%c)', 1)
|
||||
self.template_engine(template, node)
|
||||
self.prune()
|
||||
|
||||
|
Reference in New Issue
Block a user