Repository navigation
Fix import on Python 3.14 after asyncio policy API changes - #164
Open
emirmrkaljevic wants to merge 1 commit into
Open
emirmrkaljevic wants to merge 1 commit into
emirmrkaljevic wants to merge 1 commit into
Conversation
CPython 3.14 renamed BaseDefaultEventLoopPolicy to _BaseDefaultEventLoopPolicy and removed AbstractChildWatcher, which made `import trio_asyncio` raise AttributeError. Resolve the policy and child-watcher bases based on what the interpreter provides, and prefer the non-deprecated private policy helpers when installing our loop policy at import time. Fixes python-trio#160.
Author
|
The failing jobs look unrelated to this change. The pypy-3.9-nightly jobs fail during setup because there's no nightly PyPy 3.9 build available, and on Ubuntu 3.11/3.12 the only failure is CPython's own |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #160.
On Python 3.14,
import trio_asynciofails with AttributeError becauseCPython renamed
asyncio.events.BaseDefaultEventLoopPolicyto_BaseDefaultEventLoopPolicyand removedasyncio.AbstractChildWatcher(see also #152).
This PR resolves the policy and child-watcher base classes from whatever
the interpreter still provides, and uses the non-deprecated private
policy helpers on 3.14 when installing our loop policy at import time.
Older Python versions keep the previous behavior.
Note: with this change the import works on 3.14 and the new compat tests pass, but the full test suite on 3.14 still hangs in some
aio_as_triotests. That looks like a separate issue outside #160, so I left it out of this PR.