From f885201da2b985b8d25824d7cc881604052b9cf4 Mon Sep 17 00:00:00 2001 From: Cam Parry Date: Sun, 4 Mar 2018 19:52:03 +1000 Subject: [PATCH 1/3] Removed use of asyncio.coroutines.debug_wrapper --- uvloop/includes/stdlib.pxi | 1 - uvloop/loop.pyx | 1 - 2 files changed, 2 deletions(-) diff --git a/uvloop/includes/stdlib.pxi b/uvloop/includes/stdlib.pxi index c09cec57..7adad20b 100644 --- a/uvloop/includes/stdlib.pxi +++ b/uvloop/includes/stdlib.pxi @@ -38,7 +38,6 @@ cdef aio_iscoroutinefunction = asyncio.iscoroutinefunction cdef aio_BaseProtocol = asyncio.BaseProtocol cdef aio_Protocol = asyncio.Protocol cdef aio_SSLProtocol = asyncio.sslproto.SSLProtocol -cdef aio_debug_wrapper = asyncio.coroutines.debug_wrapper cdef aio_isfuture = getattr(asyncio, 'isfuture', None) cdef aio_get_running_loop = getattr(asyncio, '_get_running_loop', None) cdef aio_set_running_loop = getattr(asyncio, '_set_running_loop', None) diff --git a/uvloop/loop.pyx b/uvloop/loop.pyx index 1e505675..f58c002f 100644 --- a/uvloop/loop.pyx +++ b/uvloop/loop.pyx @@ -975,7 +975,6 @@ cdef class Loop: if self._coroutine_wrapper_set == enabled: return - wrapper = aio_debug_wrapper current_wrapper = sys_get_coroutine_wrapper() if enabled: From 607d6663f753cf824c573500fd42d6d680ddb087 Mon Sep 17 00:00:00 2001 From: Cam Parry Date: Sun, 4 Mar 2018 21:12:14 +1000 Subject: [PATCH 2/3] Fix to make uvloop/loop compile again and add conditional --- uvloop/includes/stdlib.pxi | 1 + uvloop/loop.pyx | 42 +++++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/uvloop/includes/stdlib.pxi b/uvloop/includes/stdlib.pxi index 7adad20b..c09cec57 100644 --- a/uvloop/includes/stdlib.pxi +++ b/uvloop/includes/stdlib.pxi @@ -38,6 +38,7 @@ cdef aio_iscoroutinefunction = asyncio.iscoroutinefunction cdef aio_BaseProtocol = asyncio.BaseProtocol cdef aio_Protocol = asyncio.Protocol cdef aio_SSLProtocol = asyncio.sslproto.SSLProtocol +cdef aio_debug_wrapper = asyncio.coroutines.debug_wrapper cdef aio_isfuture = getattr(asyncio, 'isfuture', None) cdef aio_get_running_loop = getattr(asyncio, '_get_running_loop', None) cdef aio_set_running_loop = getattr(asyncio, '_set_running_loop', None) diff --git a/uvloop/loop.pyx b/uvloop/loop.pyx index f58c002f..d5530450 100644 --- a/uvloop/loop.pyx +++ b/uvloop/loop.pyx @@ -974,27 +974,31 @@ cdef class Loop: enabled = bool(enabled) if self._coroutine_wrapper_set == enabled: return - - current_wrapper = sys_get_coroutine_wrapper() - - if enabled: - if current_wrapper not in (None, wrapper): - warnings.warn( - "loop.set_debug(True): cannot set debug coroutine " - "wrapper; another wrapper is already set %r" % - current_wrapper, RuntimeWarning) - else: - sys_set_coroutine_wrapper(wrapper) - self._coroutine_wrapper_set = True + + if sys_version_info >= (3, 7, 0): + pass else: - if current_wrapper not in (None, wrapper): - warnings.warn( - "loop.set_debug(False): cannot unset debug coroutine " - "wrapper; another wrapper was set %r" % - current_wrapper, RuntimeWarning) + wrapper = aio_debug_wrapper + current_wrapper = sys_get_coroutine_wrapper() + + if enabled: + if current_wrapper not in (None, wrapper): + warnings.warn( + "loop.set_debug(True): cannot set debug coroutine " + "wrapper; another wrapper is already set %r" % + current_wrapper, RuntimeWarning) + else: + sys_set_coroutine_wrapper(wrapper) + self._coroutine_wrapper_set = True else: - sys_set_coroutine_wrapper(None) - self._coroutine_wrapper_set = False + if current_wrapper not in (None, wrapper): + warnings.warn( + "loop.set_debug(False): cannot unset debug coroutine " + "wrapper; another wrapper was set %r" % + current_wrapper, RuntimeWarning) + else: + sys_set_coroutine_wrapper(None) + self._coroutine_wrapper_set = False cdef _create_server(self, system.sockaddr *addr, object protocol_factory, From ce1bf2fe77b02745d011bcba036ed3a361c5b068 Mon Sep 17 00:00:00 2001 From: Cam Parry Date: Sun, 4 Mar 2018 21:33:22 +1000 Subject: [PATCH 3/3] add travis to test on python 3.7-dev --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index b7ba7e7f..23d4cbb6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -56,6 +56,13 @@ matrix: python: "3.6" env: BUILD=tests + - os: linux + dist: trusty + sudo: false + language: python + python: "3.7-dev" + env: BUILD=tests + - os: linux dist: trusty branches: {only: [releases]}