[issue31061] asyncio segfault when using threadpool and "_asyncio" native module
Alexander Mohr
report at bugs.python.org
Mon Jul 31 16:19:42 EDT 2017
Alexander Mohr added the comment:
I'm hoping this is the fix:
--- Modules/_asynciomodule.c.orig 2017-07-31 12:16:16.000000000 -0700
+++ Modules/_asynciomodule.c 2017-07-31 13:08:52.000000000 -0700
@@ -953,15 +953,18 @@
FutureObj_dealloc(PyObject *self)
{
FutureObj *fut = (FutureObj *)self;
+ PyObject_GC_UnTrack(self);
if (Future_CheckExact(fut)) {
/* When fut is subclass of Future, finalizer is called from
* subtype_dealloc.
*/
+ _PyObject_GC_TRACK(self);
if (PyObject_CallFinalizerFromDealloc(self) < 0) {
// resurrected.
return;
}
+ _PyObject_GC_UNTRACK(self);
}
if (fut->fut_weakreflist != NULL) {
@@ -1828,14 +1831,18 @@
{
TaskObj *task = (TaskObj *)self;
+ PyObject_GC_UnTrack(self);
+
if (Task_CheckExact(self)) {
/* When fut is subclass of Task, finalizer is called from
* subtype_dealloc.
*/
+ _PyObject_GC_TRACK(self);
if (PyObject_CallFinalizerFromDealloc(self) < 0) {
// resurrected.
return;
}
+ _PyObject_GC_UNTRACK(self);
}
if (task->task_weakreflist != NULL) {
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31061>
_______________________________________
More information about the Python-bugs-list
mailing list