Commit 36c48f42 authored by Xavier Thompson's avatar Xavier Thompson

Adapt dealloc function for cypclass-wrapping c classes

parent b2b013da
......@@ -1552,6 +1552,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln(
"static void %s(PyObject *o) {" % slot_func_cname)
# for cyp wrappers, just decrement the atomic counter of the underlying type
is_cyp_wrapper = scope.parent_type.is_cyp_wrapper
if is_cyp_wrapper:
self.generate_self_cast(scope, code)
code.putln("Cy_DECREF(p->%s);" % CypclassWrapper.underlying_name)
code.putln("}")
return
is_final_type = scope.parent_type.is_final_type
needs_gc = scope.needs_gc()
needs_trashcan = scope.needs_trashcan()
......
......@@ -5355,6 +5355,8 @@ class CypclassWrapperDefNode(CClassDefNode):
def analyse_declarations(self, env):
# > analyse declarations before inserting methods
super(CypclassWrapperDefNode, self).analyse_declarations(env)
# > mark the wrapper type as such
self.entry.type.is_cyp_wrapper = 1
# > associate the wrapper type to the wrapped type
self.wrapped_cypclass.entry.type.wrapper_type = self.entry.type
# > insert and analyse each method wrapper
......
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