[Cython] Bad interaction between cimported types and module cleanup
Lisandro Dalcin
dalcinl at gmail.com
Fri Aug 3 18:51:47 CEST 2012
On 3 August 2012 01:07, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Stefan Behnel, 03.08.2012 06:04:
>> Lisandro, could you open a pull request with only the single line change
>> and a comment that properly explains why we are doing this?
>
> A code comment, just to be clear.
>
Is the comment blow clear enough for you?
Stefan, I've never used github seriously, and making a pull request
will require time I really do not have. The patch is really trivial,
any chance to push it directly? There is a policy is to use pull
requests for every change (sorry, I've not been following Cython
development closely)?
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index 2472de3..255b047 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -1111,7 +1111,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if base_type:
tp_dealloc = TypeSlots.get_base_slot_function(scope, tp_slot)
if tp_dealloc is None:
- tp_dealloc = "%s->tp_dealloc" % base_type.typeptr_cname
+ # Using the cimported base type pointer interacts
+ # badly with module cleanup nullyfing these pointers.
+ # Use instead the base type pointer from the
+ # instance's type pointer.
+ tp_dealloc = "Py_TYPE(o)->tp_base->tp_dealloc"
code.putln(
"%s(o);" % tp_dealloc)
else:
--
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
More information about the cython-devel
mailing list