Commit 51d1bd1c authored by Robert Bradshaw's avatar Robert Bradshaw

Fix #245, crash on cimported struct -> object.

parent 4d4d29d8
......@@ -1535,6 +1535,8 @@ class CStructOrUnionType(CType):
# typedef_flag boolean
# packed boolean
# entry Entry
is_struct_or_union = 1
has_attributes = 1
......@@ -1563,8 +1565,7 @@ class CStructOrUnionType(CType):
self.to_py_function = None
self._convert_code = False
return False
entry = env.lookup(self.name)
forward_decl = (entry.visibility != 'extern')
forward_decl = (self.entry.visibility != 'extern')
self._convert_code = StructUtilityCode(self, forward_decl)
env.use_utility_code(self._convert_code)
......
......@@ -363,6 +363,7 @@ class Scope(object):
entry = self.declare_type(name, type, pos, cname,
visibility = visibility, defining = scope is not None)
self.sue_entries.append(entry)
type.entry = entry
else:
if not (entry.is_type and entry.type.is_struct_or_union
and entry.type.kind == kind):
......
typedef struct {
int x
int x;
} MyStruct;
cimport crashT245_pxd
"""
__doc__ = """
>>> f()
{'x': 1}
"""
cimport crashT245_pxd
def f():
cdef crashT245_pxd.MyStruct s
s.x = 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment