``psycopg_pool`` release notes
==============================
+Future releases
+---------------
+
+psycopg_pool 3.2.4
+^^^^^^^^^^^^^^^^^^
+
+- Add a hint to the warning printed if threads fail to stop during
+ ``__del__``, which has been reported happening during interpreter shutdown
+ on Python 3.13 (see #954).
+
+
Current release
---------------
return t
-async def agather(*tasks: asyncio.Task[Any], timeout: float | None = None) -> None:
+async def agather(
+ *tasks: asyncio.Task[Any], timeout: float | None = None, timeout_hint: str = ""
+) -> None:
"""
Equivalent to asyncio.gather or Thread.join()
"""
if t.done():
continue
logger.warning("couldn't stop task %r within %s seconds", t.get_name(), timeout)
+ if timeout_hint:
+ logger.warning("hint: %s", timeout_hint)
-def gather(*tasks: threading.Thread, timeout: float | None = None) -> None:
+def gather(
+ *tasks: threading.Thread, timeout: float | None = None, timeout_hint: str = ""
+) -> None:
"""
Equivalent to asyncio.gather or Thread.join()
"""
if not t.is_alive():
continue
logger.warning("couldn't stop thread %r within %s seconds", t.name, timeout)
+ if timeout_hint:
+ logger.warning("hint: %s", timeout_hint)
def asleep(seconds: float) -> Coroutine[Any, Any, None]:
return
workers = self._signal_stop_worker()
- gather(*workers, timeout=5.0)
+ hint = "you can try to call 'close()' explicitly or to use the pool as context manager"
+ gather(*workers, timeout=5.0, timeout_hint=hint)
def _check_open_getconn(self) -> None:
super()._check_open_getconn()
return
workers = self._signal_stop_worker()
- agather(*workers, timeout=5.0)
+ hint = (
+ "you can try to call 'close()' explicitly "
+ "or to use the pool as context manager"
+ )
+ agather(*workers, timeout=5.0, timeout_hint=hint)
def _check_open_getconn(self) -> None:
super()._check_open_getconn()