From eb7a23df4c7826c62caabf308ad5b4b9199135c9 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Sat, 14 May 2016 17:40:00 -0400 Subject: [PATCH] Patch loop.c to fix a segfault in Cython. --- Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Makefile b/Makefile index 87afa32..1c3259c 100644 --- a/Makefile +++ b/Makefile @@ -84,6 +84,23 @@ src = re.sub( src, flags=re.X) +# Fix a segfault in Cython. +src = re.sub( + r''' + \s* __Pyx_Coroutine_get_qualname\(__pyx_CoroutineObject\s+\*self\) + \s* { + \s* Py_INCREF\(self->gi_qualname\); + ''', + + r''' + __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self) + { + if (self->gi_qualname == NULL) { return __pyx_empty_unicode; } + Py_INCREF(self->gi_qualname); + ''', + + src, flags=re.X) + with open('uvloop/loop.c', 'wt') as f: f.write(src) endef