You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Fix 3.3 named bug and ...
Parse 3.4 parameters correctly. Allow test_pyenvlib to do 3.3.6
This commit is contained in:
Binary file not shown.
BIN
test/bytecode_3.4/02_named_and_kwargs.pyc
Normal file
BIN
test/bytecode_3.4/02_named_and_kwargs.pyc
Normal file
Binary file not shown.
@@ -10,3 +10,10 @@ def subprocess_shell(self, protocol_factory, cmd, *, stdin=subprocess.PIPE,
|
||||
universal_newlines=False, shell=True, bufsize=0,
|
||||
**kwargs):
|
||||
return
|
||||
|
||||
# From 3.4 asyncio/locks.py
|
||||
# Bug was handling" "value=1, *"
|
||||
|
||||
class BoundedSemaphore(Semaphore):
|
||||
def __init__(self, value=1, *, loop=None):
|
||||
super().__init__(value, loop=loop)
|
||||
|
@@ -31,7 +31,7 @@ TEST_VERSIONS=('2.3.7', '2.4.6', '2.5.6', '2.6.9',
|
||||
'pypy-2.4.0', 'pypy-2.6.1',
|
||||
'pypy-5.0.1', 'pypy-5.3.1',
|
||||
'2.7.10', '2.7.11', '2.7.12',
|
||||
'3.2.6', '3.3.5', '3.4.2', '3.5.1')
|
||||
'3.2.6', '3.3.5', '3.3.6', '3.4.2', '3.5.1')
|
||||
|
||||
target_base = '/tmp/py-dis/'
|
||||
lib_prefix = os.path.join(os.environ['HOME'], '.pyenv/versions')
|
||||
|
@@ -621,9 +621,12 @@ class Python3Parser(PythonParser):
|
||||
if self.version <= 3.2:
|
||||
rule = ('mkfunc ::= %sload_closure LOAD_CONST kwargs %s'
|
||||
% ('expr ' * args_pos, opname))
|
||||
elif self.version >= 3.3:
|
||||
elif self.version == 3.3:
|
||||
rule = ('mkfunc ::= kwargs %sload_closure LOAD_CONST LOAD_CONST %s'
|
||||
% ('expr ' * args_pos, opname))
|
||||
elif self.version >= 3.4:
|
||||
rule = ('mkfunc ::= %skwargs load_closure LOAD_CONST LOAD_CONST %s'
|
||||
% ('expr ' * args_pos, opname))
|
||||
|
||||
self.add_unique_rule(rule, opname, token.attr, customize)
|
||||
rule = ('mkfunc ::= %sload_closure load_genexpr %s'
|
||||
|
@@ -2053,11 +2053,10 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
|
||||
params.reverse() # back to correct order
|
||||
|
||||
kw_pairs = 0
|
||||
kw_pairs = args_node.attr[1] if self.version >= 3.0 else 0
|
||||
|
||||
if 4 & code.co_flags: # flag 2 -> variable number of args
|
||||
if self.version > 3.0:
|
||||
kw_pairs = args_node.attr[1]
|
||||
params.append('*%s' % code.co_varnames[argc + kw_pairs])
|
||||
else:
|
||||
params.append('*%s' % code.co_varnames[argc])
|
||||
@@ -2084,6 +2083,9 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
for n in node:
|
||||
if n == 'pos_arg':
|
||||
continue
|
||||
elif self.version >= 3.4 and n.type != 'kwargs':
|
||||
continue
|
||||
else:
|
||||
self.preorder(n)
|
||||
break
|
||||
pass
|
||||
|
Reference in New Issue
Block a user