diff --git a/CHANGES.rst b/CHANGES.rst index 05ddf29900..c113092f7c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,8 @@ +2.11.904 (2024-10-25) +===================== + +- Improve (async) close procedure when used in a ``uvloop``. + 2.11.903 (2024-10-22) ===================== diff --git a/src/urllib3/_version.py b/src/urllib3/_version.py index 18deb3bd10..11195f3da5 100644 --- a/src/urllib3/_version.py +++ b/src/urllib3/_version.py @@ -1,4 +1,4 @@ # This file is protected via CODEOWNERS from __future__ import annotations -__version__ = "2.11.903" +__version__ = "2.11.904" diff --git a/src/urllib3/contrib/ssa/__init__.py b/src/urllib3/contrib/ssa/__init__.py index 0790b23cce..6b8a416e55 100644 --- a/src/urllib3/contrib/ssa/__init__.py +++ b/src/urllib3/contrib/ssa/__init__.py @@ -78,7 +78,11 @@ def close(self) -> None: try: if hasattr(self._sock, "shutdown"): - self._sock.shutdown(SHUT_RD) + try: + self._sock.shutdown(SHUT_RD) + except TypeError: # uvloop don't support shutdown! + if hasattr(self._sock, "close"): + self._sock.close() elif hasattr(self._sock, "close"): self._sock.close() # we have to force call close() on our sock object in UDP ctx. (even after shutdown)