Author: Philip Jenvey <pjen...@underboss.org>
Branch: py3k
Changeset: r73069:f9d726dbb392
Date: 2014-08-24 16:31 -0700
http://bitbucket.org/pypy/pypy/changeset/f9d726dbb392/

Log:    fix handling of None values in kw_defaults again

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
@@ -3291,7 +3291,7 @@
         if self.kw_defaults is None:
             kw_defaults_w = []
         else:
-            kw_defaults_w = [node.to_object(space) for node in 
self.kw_defaults] # expr
+            kw_defaults_w = [node.to_object(space) if node is not None else 
space.w_None for node in self.kw_defaults] # expr
         w_kw_defaults = space.newlist(kw_defaults_w)
         space.setattr(w_node, space.wrap('kw_defaults'), w_kw_defaults)
         return w_node
diff --git a/pypy/interpreter/astcompiler/tools/asdl_py.py 
b/pypy/interpreter/astcompiler/tools/asdl_py.py
--- a/pypy/interpreter/astcompiler/tools/asdl_py.py
+++ b/pypy/interpreter/astcompiler/tools/asdl_py.py
@@ -131,7 +131,9 @@
             return "space.wrap(%s)" % (value,)
         else:
             wrapper = "%s.to_object(space)" % (value,)
-            if field.opt:
+            # XXX: kw_defaults, unlike other sequences, allows None
+            # values
+            if field.opt or field.name.value == 'kw_defaults':
                 wrapper += " if %s is not None else space.w_None" % (value,)
             return wrapper
         
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to