Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/FUNDING.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v5
Expand Down
10 changes: 10 additions & 0 deletions nest_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ def _get_event_loop(stacklevel=3): # noqa: ARG001
loop = events.get_event_loop_policy().get_event_loop()
return loop

# We need to patch this since 3.14 due to:
# https://github.com/python/cpython/pull/129899
def current_task(loop=None):
"""Return a currently executed task."""
if loop is None:
loop = asyncio.events.get_running_loop()
return asyncio.tasks._current_tasks.get(loop)

# Use module level _current_tasks, all_tasks and patch run method.
if hasattr(asyncio, '_nest_patched'):
return
Expand All @@ -47,6 +55,8 @@ def _get_event_loop(stacklevel=3): # noqa: ARG001
asyncio.Future = asyncio.futures._CFuture = asyncio.futures.Future = asyncio.futures._PyFuture
events._get_event_loop = events.get_event_loop = asyncio.get_event_loop = _get_event_loop
asyncio.run = run
if sys.version_info >= (3, 14, 0):
asyncio.tasks.current_task = current_task
asyncio._nest_patched = True


Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3 :: Only",
"Framework :: AsyncIO",
]
Expand Down