More struct cleanup.
authorRobert Bradshaw <robertwb@math.washington.edu>
Wed, 8 Oct 2008 09:22:20 +0000 (02:22 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Wed, 8 Oct 2008 09:22:20 +0000 (02:22 -0700)
Cython/Compiler/PyrexTypes.py
Cython/Compiler/Symtab.py

index b6519df5c83bd5b11d33c816228d010c755c44a4..e51b0edc86829cda22f5025ee3d1694f2ddea78f 100644 (file)
@@ -953,9 +953,11 @@ class CStructOrUnionType(CType):
             code.putln("res = PyDict_New(); if (res == NULL) return NULL;")
             for member in self.scope.var_entries:
                 if member.type.to_py_function and member.type.create_convert_utility_code(env):
+                    interned_name = env.get_string_const(member.name, identifier=True)
+                    env.add_py_string(interned_name)
                     code.putln("member = %s(s.%s); if (member == NULL) goto bad;" % (
                                                 member.type.to_py_function, member.cname))
-                    code.putln("if (PyDict_SetItem(res, %s, member) < 0) goto bad;" % member.py_name.pystring_cname)
+                    code.putln("if (PyDict_SetItem(res, %s, member) < 0) goto bad;" % interned_name.pystring_cname)
                     code.putln("Py_DECREF(member);")
                 else:
                     self.to_py_function = None
index 1547dc82917170c9e8679fe18f6064f5b6c6c15f..c166953b775d72880f09a8c63a7f59a0a34a1b75 100644 (file)
@@ -359,8 +359,6 @@ class Scope:
                     self.type_entries.append(entry)
         if not scope and not entry.type.scope:
             self.check_for_illegal_incomplete_ctypedef(typedef_flag, pos)
-        if scope and self.outer_scope:
-            scope.module_scope = self
         return entry
     
     def check_previous_typedef_flag(self, entry, typedef_flag, pos):
@@ -1207,8 +1205,6 @@ class GeneratorLocalScope(LocalScope):
 class StructOrUnionScope(Scope):
     #  Namespace of a C struct or union.
     
-    module_scope = None
-
     def __init__(self, name="?"):
         Scope.__init__(self, name, None, None)
 
@@ -1221,10 +1217,6 @@ class StructOrUnionScope(Scope):
             type = PyrexTypes.CPtrType(type)
         entry = self.declare(name, cname, type, pos, visibility)
         entry.is_variable = 1
-        if self.module_scope:
-            py_name = self.module_scope.get_string_const(name, identifier=True)
-            self.module_scope.add_py_string(py_name)
-            entry.py_name = py_name
         self.var_entries.append(entry)
         if type.is_pyobject and not allow_pyobject:
             error(pos,