Commit 65604b51 authored by Amaury Forgeot d'Arc's avatar Amaury Forgeot d'Arc

Merge 3.2: Issue #12483: ctypes: Fix a crash when the destruction of a callback

  object triggers the garbage collector.
parents aa2b442b bbe46d63
......@@ -134,6 +134,14 @@ class Callbacks(unittest.TestCase):
if isinstance(x, X)]
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:
WINFUNCTYPE
except NameError:
......
......@@ -1274,6 +1274,9 @@ Tools/Demos
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
OpenIndiana/Illumos.
......
......@@ -13,6 +13,7 @@ static void
CThunkObject_dealloc(PyObject *_self)
{
CThunkObject *self = (CThunkObject *)_self;
PyObject_GC_UnTrack(self);
Py_XDECREF(self->converters);
Py_XDECREF(self->callable);
Py_XDECREF(self->restype);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment