You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Bug found by hypothesis in creating function calls
This commit is contained in:
BIN
test/bytecode_3.2/01_named_and_kwargs.pyc
Normal file
BIN
test/bytecode_3.2/01_named_and_kwargs.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.5/01_named_and_kwargs.pyc
Normal file
BIN
test/bytecode_3.5/01_named_and_kwargs.pyc
Normal file
Binary file not shown.
@@ -18,3 +18,12 @@ def __init__(self, defaults=None, dict_type=_default_dict,
|
|||||||
default_section=DEFAULTSECT,
|
default_section=DEFAULTSECT,
|
||||||
interpolation=_UNSET):
|
interpolation=_UNSET):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Bug found by hypothesis in creating function calls
|
||||||
|
# thanks to moagstar
|
||||||
|
def fn(a, b, d):
|
||||||
|
return (a, b, d)
|
||||||
|
|
||||||
|
b = {'b': 1,
|
||||||
|
'd': 2}
|
||||||
|
fn(a=0, **b)
|
||||||
|
@@ -469,19 +469,22 @@ class Python3Parser(PythonParser):
|
|||||||
('pos_arg ' * args_pos) +
|
('pos_arg ' * args_pos) +
|
||||||
('kwarg ' * args_kw) +
|
('kwarg ' * args_kw) +
|
||||||
'expr ' * nak + token.type)
|
'expr ' * nak + token.type)
|
||||||
self.add_unique_rule(rule, token.type, args_pos, customize)
|
|
||||||
|
uniq_param = args_kw + args_pos
|
||||||
|
|
||||||
|
self.add_unique_rule(rule, token.type, uniq_param, customize)
|
||||||
if self.version >= 3.5:
|
if self.version >= 3.5:
|
||||||
rule = ('async_call_function ::= expr ' +
|
rule = ('async_call_function ::= expr ' +
|
||||||
('pos_arg ' * args_pos) +
|
('pos_arg ' * args_pos) +
|
||||||
('kwarg ' * args_kw) +
|
('kwarg ' * args_kw) +
|
||||||
'expr ' * nak + token.type +
|
'expr ' * nak + token.type +
|
||||||
' GET_AWAITABLE LOAD_CONST YIELD_FROM')
|
' GET_AWAITABLE LOAD_CONST YIELD_FROM')
|
||||||
self.add_unique_rule(rule, token.type, args_pos, customize)
|
self.add_unique_rule(rule, token.type, uniq_param, customize)
|
||||||
self.add_unique_rule('expr ::= async_call_function', token.type, args_pos, customize)
|
self.add_unique_rule('expr ::= async_call_function', token.type, uniq_param, customize)
|
||||||
|
|
||||||
rule = ('classdefdeco2 ::= LOAD_BUILD_CLASS mkfunc %s%s_%d'
|
rule = ('classdefdeco2 ::= LOAD_BUILD_CLASS mkfunc %s%s_%d'
|
||||||
% (('expr ' * (args_pos-1)), opname, args_pos))
|
% (('expr ' * (args_pos-1)), opname, args_pos))
|
||||||
self.add_unique_rule(rule, token.type, args_pos, customize)
|
self.add_unique_rule(rule, token.type, uniq_param, customize)
|
||||||
|
|
||||||
def add_make_function_rule(self, rule, opname, attr, customize):
|
def add_make_function_rule(self, rule, opname, attr, customize):
|
||||||
"""Python 3.3 added a an addtional LOAD_CONST before MAKE_FUNCTION and
|
"""Python 3.3 added a an addtional LOAD_CONST before MAKE_FUNCTION and
|
||||||
|
Reference in New Issue
Block a user