Fix 3.3 named bug and ...

Parse 3.4 parameters correctly.
Allow test_pyenvlib to do 3.3.6
This commit is contained in:
rocky
2016-09-05 23:39:20 -04:00
parent 60b25f7596
commit fecae9f902
6 changed files with 17 additions and 5 deletions

Binary file not shown.

View File

@@ -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)

View File

@@ -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')

View File

@@ -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'

View File

@@ -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,7 +2083,10 @@ class SourceWalker(GenericASTTraversal, object):
for n in node:
if n == 'pos_arg':
continue
self.preorder(n)
elif self.version >= 3.4 and n.type != 'kwargs':
continue
else:
self.preorder(n)
break
pass