From 5d0b442b1d48521383a202422cccd9b169c23240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 10 Jun 2019 14:02:52 +0200 Subject: [PATCH] sys.set_coroutine_wrapper is removed in Python 3.8 The functions `sys.set_coroutine_wrapper` and `sys.get_coroutine_wrapper`, which were provisionally added to Python 3.5 and deprecated in Python 3.7, are removed in Python 3.8. uvloop doesn't use them since Python 3.7, but they remained defined in stdlib.pxi, leading to AttributeErrors on Python 3.8+. This makes the definition fallback to None if such functions don't exist. Fixes https://github.com/MagicStack/uvloop/issues/251 --- uvloop/includes/stdlib.pxi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uvloop/includes/stdlib.pxi b/uvloop/includes/stdlib.pxi index ecd8dbe9..abd304de 100644 --- a/uvloop/includes/stdlib.pxi +++ b/uvloop/includes/stdlib.pxi @@ -116,8 +116,8 @@ cdef stat_S_ISSOCK = stat.S_ISSOCK cdef sys_ignore_environment = sys.flags.ignore_environment cdef sys_exc_info = sys.exc_info -cdef sys_set_coroutine_wrapper = sys.set_coroutine_wrapper -cdef sys_get_coroutine_wrapper = sys.get_coroutine_wrapper +cdef sys_set_coroutine_wrapper = getattr(sys, 'set_coroutine_wrapper', None) +cdef sys_get_coroutine_wrapper = getattr(sys, 'get_coroutine_wrapper', None) cdef sys_getframe = sys._getframe cdef sys_version_info = sys.version_info cdef sys_getfilesystemencoding = sys.getfilesystemencoding