Commit c8e408aa authored by Xavier Thompson's avatar Xavier Thompson

Adapt dealloc function for cypclass-wrapping c classes

parent 7e5e7478
...@@ -1554,6 +1554,14 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1554,6 +1554,14 @@ 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("}")
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()
......
...@@ -5355,6 +5355,8 @@ class CypclassWrapperDefNode(CClassDefNode): ...@@ -5355,6 +5355,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