Activate debug mode when `-X dev` is used

This commit is contained in:
Jakub Kuczys 2022-08-06 23:44:31 +02:00 committed by Fantix King
parent 8e42921d7b
commit 637a77a3a4
2 changed files with 4 additions and 2 deletions

View File

@ -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)

View File

@ -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: