Closed
Description
Describe the bug
aiohttp fails to build with Python 3.12.0a7 due to changes in asyncio module.
asyncio.set_child_watcher(), asyncio.get_child_watcher(), asyncio.AbstractEventLoopPolicy.set_child_watcher() and asyncio.AbstractEventLoopPolicy.get_child_watcher() are deprecated and will be removed in Python 3.14. (Contributed by Kumar Aditya in gh-94597.)
To Reproduce
Build aiohttp with Python 3.12.0a7+.
Expected behavior
aiohttp builds successfully.
Logs/tracebacks
________ ERROR at setup of test_keepalive_two_requests_success[pyloop] _________
loop_factory = <class 'asyncio.unix_events._UnixDefaultEventLoopPolicy'>
fast = False, loop_debug = False
@pytest.fixture
def loop(loop_factory, fast, loop_debug): # type: ignore[no-untyped-def]
"""Return an instance of the event loop."""
policy = loop_factory()
asyncio.set_event_loop_policy(policy)
> with loop_context(fast=fast) as _loop:
fast = False
loop_debug = False
loop_factory = <class 'asyncio.unix_events._UnixDefaultEventLoopPolicy'>
policy = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f9982bf67b0>
../../BUILDROOT/python-aiohttp-3.8.4-2.fc39.x86_64/usr/lib64/python3.12/site-packages/aiohttp/pytest_plugin.py:230:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.12/contextlib.py:137: in __enter__
return next(self.gen)
self = <contextlib._GeneratorContextManager object at 0x7f9982bf6990>
../../BUILDROOT/python-aiohttp-3.8.4-2.fc39.x86_64/usr/lib64/python3.12/site-packages/aiohttp/test_utils.py:520: in loop_context
loop = setup_test_loop(loop_factory)
fast = False
loop_factory = <function new_event_loop at 0x7f9983f345e0>
../../BUILDROOT/python-aiohttp-3.8.4-2.fc39.x86_64/usr/lib64/python3.12/site-packages/aiohttp/test_utils.py:555: in setup_test_loop
policy.set_child_watcher(watcher)
loop = <_UnixSelectorEventLoop running=False closed=False debug=False>
loop_factory = <function new_event_loop at 0x7f9983f345e0>
module = 'asyncio.unix_events'
policy = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f9982bf67b0>
skip_watcher = False
watcher = <asyncio.unix_events.ThreadedChildWatcher object at 0x7f9982bf7530>
/usr/lib64/python3.12/asyncio/unix_events.py:1496: in set_child_watcher
warnings._deprecated("set_child_watcher",
self = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f9982bf67b0>
watcher = <asyncio.unix_events.ThreadedChildWatcher object at 0x7f9982bf7530>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'set_child_watcher'
message = '{name!r} is deprecated as of Python 3.12 and will be removed in Python {remove}.'
def _deprecated(name, message=_DEPRECATED_MSG, *, remove, _version=sys.version_info):
"""Warn that *name* is deprecated or should be removed.
RuntimeError is raised if *remove* specifies a major/minor tuple older than
the current Python version or the same version but past the alpha.
The *message* argument is formatted with *name* and *remove* as a Python
version (e.g. "3.11").
"""
remove_formatted = f"{remove[0]}.{remove[1]}"
if (_version[:2] > remove) or (_version[:2] == remove and _version[3] != "alpha"):
msg = f"{name!r} was slated for removal after Python {remove_formatted} alpha"
raise RuntimeError(msg)
else:
msg = message.format(name=name, remove=remove_formatted)
> warn(msg, DeprecationWarning, stacklevel=3)
E DeprecationWarning: 'set_child_watcher' is deprecated as of Python 3.12 and will be removed in Python 3.14.
_version = sys.version_info(major=3, minor=12, micro=0, releaselevel='alpha', serial=7)
message = '{name!r} is deprecated as of Python 3.12 and will be removed in Python {remove}.'
msg = "'set_child_watcher' is deprecated as of Python 3.12 and will be removed in Python 3.14."
name = 'set_child_watcher'
remove = (3, 14)
remove_formatted = '3.14'
/usr/lib64/python3.12/warnings.py:529: DeprecationWarning
...
= 438 failed, 810 passed, 16 skipped, 23 deselected, 4 xfailed, 1295 errors in 102.54s (0:01:42) =Python Version
$ python --version
Python 3.12.0a7aiohttp Version
$ python -m pip show aiohttp
3.8.4multidict Version
$ python -m pip show multidict
6.0.4yarl Version
$ python -m pip show yarl
1.9.2OS
Fedora rawhide x86_64
Related component
Server, Client
Additional context
No response
Code of Conduct
- I agree to follow the aio-libs Code of Conduct