[pypy-svn] r32527 - pypy/dist/pypy/translator/c

benyoung at codespeak.net benyoung at codespeak.net
Wed Sep 20 16:03:33 CEST 2006


Author: benyoung
Date: Wed Sep 20 16:03:25 2006
New Revision: 32527

Modified:
   pypy/dist/pypy/translator/c/node.py
Log:
Fix the initialisation of unions

Modified: pypy/dist/pypy/translator/c/node.py
==============================================================================
--- pypy/dist/pypy/translator/c/node.py	(original)
+++ pypy/dist/pypy/translator/c/node.py	Wed Sep 20 16:03:25 2006
@@ -460,6 +460,11 @@
         for name in self.T._names:
             data.append((name, getattr(self.obj, name)))
         
+        # You can only initialise the first field of a union in c
+        # XXX what if later fields have some initialisation?
+        if hasattr(self.T, "_hints") and self.T._hints.get('union'):
+            data = data[0:1]
+
         for name, value in data:
             if isinstance(value, _pyobjheader):   # hack
                 node = self.db.getcontainernode(value)



More information about the Pypy-commit mailing list