crash from __del__ method at script end
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cython |
Fix Released
|
Undecided
|
robertwb |
Bug Description
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_
(gdb) print __pyx_n_myattr
$2 = (PyObject *) 0x0
It appears that the pointer to the attribute has become zero.
Changed in cython: | |
assignee: | nobody → robertwb |
status: | New → Fix Committed |
Changed in cython: | |
status: | Fix Committed → Fix Released |
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: GetAttr( __pyx_v_ self, __pyx_n_myattr); /bugs.launchpad .net/bugs/ 175295
>
> 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_
>
> (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:/
> You received this bug notification because you are a member of Cython-
> dev, which is the bug contact for Cython.