Comment 1 for bug 175295

Revision history for this message
robertwb (robertwb) wrote : Re: [Bug 175295] crash from __del__ method at script end

This is an error when the "cleanup" functionality cleans up a module
before all instances of its types are gone. Change the cleanup level
in Options.py to 0 and it should go away. (I'm thinking of making
this the default.)

- Robert

On Dec 10, 2007, at 5:36 AM, Hans Terlouw wrote:

> Public bug reported:
>
> Version 0.9.6.9. -- 0.9.6.7 didn't have this problem.
> Python versions 2.3, 2.4 and 2.5.
> Operating systems Fedora Core 4 and Fedora 8.
>
> When the __del__ is called at script end by Python and this method
> refers to an attribute, Python crashes with a segmentation violation.
> When the __del__ method is called from within the script, it behaves
> normally. Example code below:
>
> tdel.pyx:
>
> class myclass(object):
> def __init__(self):
> self.myattr = 'my attribute'
>
> def show(self):
> print 'from show() :', self.myattr
>
> def __del__(self):
> print 'from __del__() :', self.myattr
>
> The following script crashes at the end:
>
> #!/bin/env python
> import tdel
> t = tdel.myclass()
> t.show()
>
> When the statement 'del t' is added at the end, it runs and exits
> normally.
>
> Debugger information:
>
> __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_myattr);
>
> (gdb) print __pyx_n_myattr
> $2 = (PyObject *) 0x0
>
> It appears that the pointer to the attribute has become zero.
>
> ** Affects: cython
> Importance: Undecided
> Status: New
>
> --
> crash from __del__ method at script end
> https://bugs.launchpad.net/bugs/175295
> You received this bug notification because you are a member of Cython-
> dev, which is the bug contact for Cython.