Commit 8dd69721 authored by gsamain's avatar gsamain

CythonExtensionType type test unification (DictNode memory init code)

parent a77e71bc
......@@ -8843,9 +8843,12 @@ class DictNode(ExprNode):
# pairs are evaluated and used one at a time.
code.mark_pos(self.pos)
self.allocate_temp_result(code)
if hasattr(self.type, 'nogil') and self.type.nogil:
if self.type.is_extension_type and not self.type.is_pyobject:
# CythonExtensionTypes are allocated "by-hand"
code.putln("%s = (struct %s *)malloc(sizeof(struct %s));" % (self.result(), self.type.objstruct_cname, self.type.objstruct_cname))
# And their method table must be properly set (self.type.vtabptr_cname is set at runtime)
code.putln("%s->%s = %s;" % (self.result(), self.type.vtabslot_cname, self.type.vtabptr_cname))
# Finally set the reference counting
code.putln("_CyObject_CAST(%s)->ob_refcnt = 1;" % self.result())
is_dict = self.type.is_pyobject
......
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