Commit ff2db658 authored by Xavier Thompson's avatar Xavier Thompson

Adapt dealloc function for cypclass-wrapping c classes

parent 19193e74
...@@ -1683,6 +1683,16 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1683,6 +1683,16 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln( code.putln(
"static void %s(PyObject *o) {" % slot_func_cname) "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("}")
if cdealloc_func_entry is None:
code.putln("#endif")
return
is_final_type = scope.parent_type.is_final_type is_final_type = scope.parent_type.is_final_type
needs_gc = scope.needs_gc() needs_gc = scope.needs_gc()
needs_trashcan = scope.needs_trashcan() needs_trashcan = scope.needs_trashcan()
......
...@@ -5566,6 +5566,8 @@ class CypclassWrapperDefNode(CClassDefNode): ...@@ -5566,6 +5566,8 @@ class CypclassWrapperDefNode(CClassDefNode):
def analyse_declarations(self, env): def analyse_declarations(self, env):
# > analyse declarations before inserting methods # > analyse declarations before inserting methods
super(CypclassWrapperDefNode, self).analyse_declarations(env) 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 # > associate the wrapper type to the wrapped type
self.wrapped_cypclass.entry.type.wrapper_type = self.entry.type self.wrapped_cypclass.entry.type.wrapper_type = self.entry.type
# > insert and analyse each method wrapper # > 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