Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r72836:7da16b3cbdc2
Date: 2014-08-16 18:04 -0700
http://bitbucket.org/pypy/pypy/changeset/7da16b3cbdc2/
Log: fix handling of None values in kw_defaults, which are valid. found
by py3.3's tests
diff --git a/pypy/interpreter/astcompiler/ast.py
b/pypy/interpreter/astcompiler/ast.py
--- a/pypy/interpreter/astcompiler/ast.py
+++ b/pypy/interpreter/astcompiler/ast.py
@@ -2416,7 +2416,8 @@
self.kw_defaults = None
if self.kw_defaults is not None:
for node in self.kw_defaults:
- node.sync_app_attrs(space)
+ if node:
+ node.sync_app_attrs(space)
class arg(AST):
diff --git a/pypy/interpreter/astcompiler/test/test_compiler.py
b/pypy/interpreter/astcompiler/test/test_compiler.py
--- a/pypy/interpreter/astcompiler/test/test_compiler.py
+++ b/pypy/interpreter/astcompiler/test/test_compiler.py
@@ -1034,6 +1034,13 @@
exec('# -*- coding: utf-8 -*-\n\nu = "\xf0\x9f\x92\x8b"', d)
assert len(d['u']) == 4
+ def test_kw_defaults_None(self):
+ import _ast
+ source = "def foo(self, *args, name): pass"
+ ast = compile(source, '', 'exec', _ast.PyCF_ONLY_AST)
+ # compiling the produced AST previously triggered a crash
+ compile(ast, '', 'exec')
+
class TestOptimizations:
def count_instructions(self, source):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit