Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Oct 31, 2024
1 parent 3700cee commit 54e4b79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 deletions.
19 changes: 8 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,18 @@ asyncio-compatible timeout context manager.
DEPRECATED
----------

This library has effectively been upstreamed into Python 3.11+. Therefore this library
is considered deprecated and no longer supported. We'll keep the project open in the
unlikely case of security issues until Python 3.10 is officially unsupported.
This library has effectively been upstreamed into Python 3.11+.

To migrate a project that needs to support multiple Python versions, we suggest
using this code (used in our other projects, such as aiohttp)::
Therefore this library is considered deprecated and no longer actively supported.

if sys.version_info >= (3, 11):
import asyncio as async_timeout
else:
import async_timeout
Version 5.0+ provides dual-mode when executed on Python 3.11+:
``asyncio_timeout.Timeout`` is fully compatible with ``asyncio.Timeout`` *and* old
versions of the library.

Then in your dependencies, use::
Anyway, using upstream is highly recommended. ``asyncio_timeout`` exists only for the
sake of backward compatibility, easy supporting both old and new Python by the same
code, and easy misgration.

async-timeout >= 4; python_version < "3.11"

Usage example
-------------
Expand Down
14 changes: 1 addition & 13 deletions async_timeout/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,7 @@
from typing import Optional, Type, final


if sys.version_info >= (3, 11):

def _uncancel_task(task: "asyncio.Task[object]") -> None:
task.uncancel()

else:

def _uncancel_task(task: "asyncio.Task[object]") -> None:
pass


__version__ = "4.0.3"
__version__ = "5.0.0"


__all__ = ("timeout", "timeout_at", "Timeout")
Expand Down Expand Up @@ -271,7 +260,6 @@ def _do_enter(self) -> None:
def _do_exit(self, exc_type: Optional[Type[BaseException]]) -> None:
if exc_type is asyncio.CancelledError and self._state == _State.TIMEOUT:
assert self._task is not None
_uncancel_task(self._task)
self._timeout_handler = None
self._task = None
raise asyncio.TimeoutError
Expand Down

0 comments on commit 54e4b79

Please sign in to comment.