From 9e6c20a156a991cdcbc5d2f238891a7b9f5b6db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 12 Mar 2025 14:36:01 +0100 Subject: [PATCH 1/2] Workaround missing BaseDefaultEventLoopPolicy in Python 3.14 This uses private API now. Proper fix pending discussion in https://github.com/python/cpython/issues/131148 --- uvloop/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/uvloop/__init__.py b/uvloop/__init__.py index 9bb6592b..283a5b03 100644 --- a/uvloop/__init__.py +++ b/uvloop/__init__.py @@ -3,7 +3,11 @@ import sys as _sys import warnings as _warnings -from asyncio.events import BaseDefaultEventLoopPolicy as __BasePolicy +try: + from asyncio.events import BaseDefaultEventLoopPolicy as __BasePolicy +except ImportError: + # https://github.com/python/cpython/issues/131148 + from asyncio.events import _BaseDefaultEventLoopPolicy as __BasePolicy from . import includes as __includes # NOQA from .loop import Loop as __BaseLoop # NOQA From 7918640939788fed218738781df1110c842fc732 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Sun, 20 Oct 2024 21:42:23 +0100 Subject: [PATCH 2/2] Deal with removed AbstractChildWatcher Fixes https://github.com/MagicStack/uvloop/issues/637 --- uvloop/includes/stdlib.pxi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uvloop/includes/stdlib.pxi b/uvloop/includes/stdlib.pxi index 4152b8a7..afb01fe4 100644 --- a/uvloop/includes/stdlib.pxi +++ b/uvloop/includes/stdlib.pxi @@ -44,7 +44,7 @@ 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) cdef aio_debug_wrapper = getattr(asyncio.coroutines, 'debug_wrapper', None) -cdef aio_AbstractChildWatcher = asyncio.AbstractChildWatcher +cdef aio_AbstractChildWatcher = getattr(asyncio, 'AbstractChildWatcher', object()) cdef aio_Transport = asyncio.Transport cdef aio_FlowControlMixin = asyncio.transports._FlowControlMixin