[Cython] segfault in 'async def' coroutines

Stefan Behnel stefan_ml at behnel.de
Mon May 16 03:58:27 EDT 2016


Yury Selivanov schrieb am 14.05.2016 um 23:31:
> Under some circumstances, in asyncio code that runs in uvloop [1],
> cython code segfaults in cython/Cython/Utility/Coroutine.c:
> 
> 
>   static PyObject *
>   __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self)
>   {
>     Py_INCREF(self->gi_qualname);
>     return self->gi_qualname;
>   }
> 
> 
> "self->gi_qualname" can be NULL.  The correct code is probably:
> 
> 
>   __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self)
>   {
>     if (self->gi_qualname == NULL) { return __pyx_empty_unicode; }
>     Py_INCREF(self->gi_qualname);
>     return self->gi_qualname;
>   }

I wonder why it can be NULL. It's supposed to be set to a string constant
at creation time. See GeneratorDefNode in Nodes.py. Is there anything
special you are doing with these objects? Could you try to figure out how
the ones that have a NULL value here are created?

Stefan



More information about the cython-devel mailing list