[issue22916] Interpreter segfault on attempted tab complete
eryksun
report at bugs.python.org
Sat Nov 22 22:42:32 CET 2014
eryksun added the comment:
This isn't a bug in Python or tab completion. You can reproduce the fault by referencing s.transformable twice and then deleting both references.
The getter for TransformableDrawable.transformable calls wrap_transformable to create a wrapper for the underlying C++ object (self.p_transformable).
TransformDrawable
https://github.com/Sonkun/python-sfml/blob/v1.3/src/sfml/graphics.pyx#L1175
wrap_transformable
https://github.com/Sonkun/python-sfml/blob/v1.3/src/sfml/graphics.pyx#L381
Thus each Transformable wrapper references the same C++ object.
Transformable.__dealloc__ in graphics.pyx
https://github.com/Sonkun/python-sfml/blob/v1.3/src/sfml/graphics.pyx#L1117
gets Cythonized as __pyx_pf_4sfml_8graphics_13Transformable_2__dealloc__ in graphics.cpp. This executes the C++ delete that segfaults:
delete __pyx_v_self->p_this;
For example:
>>> x = s.transformable
>>> y = s.transformable
>>> del y
Breakpoint 1, __pyx_pf_4sfml_8graphics_13Transformable_2__dealloc__
(__pyx_v_self=0xb774d8c0) at src/sfml/graphics.cpp:21354
21354 delete __pyx_v_self->p_this;
(gdb) p __pyx_v_self->p_this
$1 = (sf::Transformable *) 0x8695b24
(gdb) c
Continuing.
>>> del x
Breakpoint 1, __pyx_pf_4sfml_8graphics_13Transformable_2__dealloc__
(__pyx_v_self=0xb774d910) at src/sfml/graphics.cpp:21354
21354 delete __pyx_v_self->p_this;
(gdb) p __pyx_v_self->p_this
$2 = (sf::Transformable *) 0x8695b24
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
----------
nosy: +eryksun
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22916>
_______________________________________
More information about the Python-bugs-list
mailing list