Commit 279e68ea authored by Lisandro Dalcin's avatar Lisandro Dalcin

fix bad core generation for ctypedef classes when init tp_weaklistoffset type slot

parent 76e9534b
......@@ -1959,10 +1959,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if weakref_entry:
if weakref_entry.type is py_object_type:
tp_weaklistoffset = "%s.tp_weaklistoffset" % typeobj_cname
code.putln("if (%s == 0) %s = offsetof(struct %s, %s);" % (
if type.typedef_flag:
objstruct = type.objstruct_cname
else:
objstruct = "struct %s" % type.objstruct_cname
code.putln("if (%s == 0) %s = offsetof(%s, %s);" % (
tp_weaklistoffset,
tp_weaklistoffset,
type.objstruct_cname,
objstruct,
weakref_entry.cname))
else:
error(weakref_entry.pos, "__weakref__ slot must be of type 'object'")
......
__doc__ = u"""
"""
cdef class A:
cdef __weakref__
ctypedef public class B [type B_Type, object BObject]:
cdef __weakref__
cdef public class C [type C_Type, object CObject]:
cdef __weakref__
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