Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broken on python3.14 ('asyncio' has no attribute 'get_child_watcher') #583

Open
zokrezyl opened this issue Jan 1, 2025 · 2 comments · May be fixed by #584
Open

broken on python3.14 ('asyncio' has no attribute 'get_child_watcher') #583

zokrezyl opened this issue Jan 1, 2025 · 2 comments · May be fixed by #584

Comments

@zokrezyl
Copy link

zokrezyl commented Jan 1, 2025

Hi,

unfortunatelly pynvim seems to be broken on 3.14

Traceback (most recent call last):
  File "/Users/user/work/my/ylib/sandbox/py/nvim/t.py", line 2, in <module>
    nvim = pynvim.attach('child', argv=["/usr/bin/env", "nvim", "--embed", "--headless"])
  File "/Users/user/.local/venv/python3.14/lib/python3.14/site-packages/pynvim/__init__.py", line 144, in attach
    child_session(cast(List[str], argv)) if session_type == 'child' else
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/.local/venv/python3.14/lib/python3.14/site-packages/pynvim/msgpack_rpc/__init__.py", line 49, in child_session
    return session('child', argv)
  File "/Users/user/.local/venv/python3.14/lib/python3.14/site-packages/pynvim/msgpack_rpc/__init__.py", line 23, in session
    loop = EventLoop(transport_type, *args, **kwargs)
  File "/Users/user/.local/venv/python3.14/lib/python3.14/site-packages/pynvim/msgpack_rpc/event_loop/asyncio.py", line 132, in __init__
    super().__init__(transport_type, *args, **kwargs)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/.local/venv/python3.14/lib/python3.14/site-packages/pynvim/msgpack_rpc/event_loop/base.py", line 109, in __init__
    raise e
  File "/Users/user/.local/venv/python3.14/lib/python3.14/site-packages/pynvim/msgpack_rpc/event_loop/base.py", line 106, in __init__
    getattr(self, '_connect_{}'.format(transport_type))(*args, **kwargs)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/user/.local/venv/python3.14/lib/python3.14/site-packages/pynvim/msgpack_rpc/event_loop/asyncio.py", line 201, in _connect_child
    self._child_watcher = asyncio.get_child_watcher()
                          ^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'asyncio' has no attribute 'get_child_watcher'


@justinmk
Copy link
Member

justinmk commented Jan 1, 2025

Thanks for reporting. Looks like get_child_watcher is deprecated since python 3.12: https://docs.python.org/3/library/asyncio-policy.html#asyncio.AbstractEventLoopPolicy.get_child_watcher

An alternative isn't mentioned...

@justinmk justinmk changed the title pynvim broken on python3.14 broken on python3.14 ('asyncio' has no attribute 'get_child_watcher') Jan 1, 2025
@cryptomilk
Copy link
Contributor

I have a fix for that.

cryptomilk added a commit to cryptomilk/pynvim that referenced this issue Jan 3, 2025
Use PidfdChildWatcher if os.pidfd_open is available and works, and
otherwise use ThreadedChildWatcher which should work in any case.

Fixes neovim#583
@cryptomilk cryptomilk linked a pull request Jan 3, 2025 that will close this issue
cryptomilk added a commit to cryptomilk/pynvim that referenced this issue Jan 3, 2025
Use PidfdChildWatcher if os.pidfd_open is available and works, and
otherwise use ThreadedChildWatcher which should work in any case.

Fixes neovim#583
cryptomilk added a commit to cryptomilk/pynvim that referenced this issue Jan 4, 2025
Use PidfdChildWatcher if os.pidfd_open is available and works, and
otherwise use ThreadedChildWatcher which should work in any case.

Fixes neovim#583
cryptomilk added a commit to cryptomilk/pynvim that referenced this issue Jan 6, 2025
Use PidfdChildWatcher if os.pidfd_open is available and works, and
otherwise use ThreadedChildWatcher which should work in any case.

Fixes neovim#583
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants