Skip to content

Commit 72c8e2a

Browse files
hroncok1st1
authored andcommitted
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 #251
1 parent 291afec commit 72c8e2a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

uvloop/includes/stdlib.pxi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ cdef stat_S_ISSOCK = stat.S_ISSOCK
116116

117117
cdef sys_ignore_environment = sys.flags.ignore_environment
118118
cdef sys_exc_info = sys.exc_info
119-
cdef sys_set_coroutine_wrapper = sys.set_coroutine_wrapper
120-
cdef sys_get_coroutine_wrapper = sys.get_coroutine_wrapper
119+
cdef sys_set_coroutine_wrapper = getattr(sys, 'set_coroutine_wrapper', None)
120+
cdef sys_get_coroutine_wrapper = getattr(sys, 'get_coroutine_wrapper', None)
121121
cdef sys_getframe = sys._getframe
122122
cdef sys_version_info = sys.version_info
123123
cdef sys_getfilesystemencoding = sys.getfilesystemencoding

0 commit comments

Comments
 (0)