Issue #12483: ctypes: Fix a crash when the destruction of a callback
object triggers the garbage collector.
This commit is contained in:
parent
dcdc3ef5fa
commit
439c25eb9e
|
@ -140,6 +140,14 @@ class Callbacks(unittest.TestCase):
|
||||||
if isinstance(x, X)]
|
if isinstance(x, X)]
|
||||||
self.assertEqual(len(live), 0)
|
self.assertEqual(len(live), 0)
|
||||||
|
|
||||||
|
def test_issue12483(self):
|
||||||
|
import gc
|
||||||
|
class Nasty:
|
||||||
|
def __del__(self):
|
||||||
|
gc.collect()
|
||||||
|
CFUNCTYPE(None)(lambda x=Nasty(): None)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
WINFUNCTYPE
|
WINFUNCTYPE
|
||||||
except NameError:
|
except NameError:
|
||||||
|
|
|
@ -192,6 +192,9 @@ Library
|
||||||
Extension Modules
|
Extension Modules
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #12483: ctypes: Fix a crash when the destruction of a callback
|
||||||
|
object triggers the garbage collector.
|
||||||
|
|
||||||
- Issue #12950: Fix passing file descriptors in multiprocessing, under
|
- Issue #12950: Fix passing file descriptors in multiprocessing, under
|
||||||
OpenIndiana/Illumos.
|
OpenIndiana/Illumos.
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ static void
|
||||||
CThunkObject_dealloc(PyObject *_self)
|
CThunkObject_dealloc(PyObject *_self)
|
||||||
{
|
{
|
||||||
CThunkObject *self = (CThunkObject *)_self;
|
CThunkObject *self = (CThunkObject *)_self;
|
||||||
|
PyObject_GC_UnTrack(self);
|
||||||
Py_XDECREF(self->converters);
|
Py_XDECREF(self->converters);
|
||||||
Py_XDECREF(self->callable);
|
Py_XDECREF(self->callable);
|
||||||
Py_XDECREF(self->restype);
|
Py_XDECREF(self->restype);
|
||||||
|
|
Loading…
Reference in New Issue