Skip to content

Commit

Permalink
sys.set_coroutine_wrapper is removed in Python 3.8
Browse files Browse the repository at this point in the history
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 MagicStack#251
  • Loading branch information
hroncok committed Jun 10, 2019
1 parent cbbac15 commit 0205d42
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions uvloop/includes/stdlib.pxi
Expand Up @@ -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
Expand Down

0 comments on commit 0205d42

Please sign in to comment.