python-trio / trio-asyncio

a re-implementation of the asyncio mainloop on top of Trio
Other
187 stars 37 forks source link

TrioChildWatcher inherits asyncio.AbstractChildWatcher, which is deprecated as of Python 3.12 #152

Open mikenerone opened 1 month ago

mikenerone commented 1 month ago

Per deprecations listed in What's New In Python 3.12, asyncio.AbstractChildWatcher is deprecated. TrioChildWatcher in trio-asyncio inherits it, leading to warnings with Python 3.12.

This is demonstrated in any 3.12 environment:

❯ python -W error -c "import trio_asyncio"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/mikenerone/dev/nexhealth/nexhealth-sync-system/nexhealth-sync-modmed/.venv/lib/python3.12/site-packages/trio_asyncio/__init__.py", line 19, in <module>
    from ._loop import (
  File "/Users/mikenerone/dev/nexhealth/nexhealth-sync-system/nexhealth-sync-modmed/.venv/lib/python3.12/site-packages/trio_asyncio/_loop.py", line 365, in <module>
    class TrioChildWatcher(
  File "/Users/mikenerone/Library/Application Support/pdm/python/cpython@3.12.2/lib/python3.12/asyncio/unix_events.py", line 858, in __init_subclass__
    warnings._deprecated("AbstractChildWatcher",
  File "/Users/mikenerone/Library/Application Support/pdm/python/cpython@3.12.2/lib/python3.12/warnings.py", line 530, in _deprecated
    warn(msg, DeprecationWarning, stacklevel=3)
DeprecationWarning: 'AbstractChildWatcher' is deprecated as of Python 3.12 and will be removed in Python 3.14.
jmehnle commented 1 month ago

Context for the deprecation is at https://github.com/python/cpython/issues/94597.