From 637a77a3a448cc091af172dbdc3f7b5fafcde000 Mon Sep 17 00:00:00 2001 From: Jakub Kuczys <6032823+jack1142@users.noreply.github.com> Date: Sat, 6 Aug 2022 23:44:31 +0200 Subject: [PATCH] Activate debug mode when `-X dev` is used --- uvloop/includes/stdlib.pxi | 1 + uvloop/loop.pyx | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/uvloop/includes/stdlib.pxi b/uvloop/includes/stdlib.pxi index 3c27687f..a5ef7954 100644 --- a/uvloop/includes/stdlib.pxi +++ b/uvloop/includes/stdlib.pxi @@ -116,6 +116,7 @@ cdef os_fspath = os.fspath cdef stat_S_ISSOCK = stat.S_ISSOCK cdef sys_ignore_environment = sys.flags.ignore_environment +cdef sys_dev_mode = sys.flags.dev_mode cdef sys_exc_info = sys.exc_info cdef sys_set_coroutine_wrapper = getattr(sys, 'set_coroutine_wrapper', None) cdef sys_get_coroutine_wrapper = getattr(sys, 'get_coroutine_wrapper', None) diff --git a/uvloop/loop.pyx b/uvloop/loop.pyx index 86141cb1..05f9f0ed 100644 --- a/uvloop/loop.pyx +++ b/uvloop/loop.pyx @@ -223,8 +223,9 @@ cdef class Loop: return main_thread_id == PyThread_get_thread_ident() def __init__(self): - self.set_debug((not sys_ignore_environment - and bool(os_environ.get('PYTHONASYNCIODEBUG')))) + self.set_debug( + sys_dev_mode or (not sys_ignore_environment + and bool(os_environ.get('PYTHONASYNCIODEBUG')))) def __dealloc__(self): if self._running == 1: