``psycopg_pool`` release notes
==============================
+Future releases
+---------------
+
+psycopg_pool 3.1.9 (unreleased)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Fix the return type annotation of `!NullConnectionPool.__enter__()`
+ (part of :ticket:`#540`).
+
+
Current release
---------------
from queue import Queue, Empty
from types import TracebackType
from typing import Any, Callable, Dict, Iterator, List
-from typing import Optional, Sequence, Type
+from typing import Optional, Sequence, Type, TypeVar
from weakref import ref
from contextlib import contextmanager
class ConnectionPool(BasePool[Connection[Any]]):
+ _Self = TypeVar("_Self", bound="ConnectionPool")
+
def __init__(
self,
conninfo: str = "",
timeout,
)
- def __enter__(self) -> "ConnectionPool":
+ def __enter__(self: _Self) -> _Self:
self.open()
return self
from time import monotonic
from types import TracebackType
from typing import Any, AsyncIterator, Awaitable, Callable
-from typing import Dict, List, Optional, Sequence, Type
+from typing import Dict, List, Optional, Sequence, Type, TypeVar
from weakref import ref
from contextlib import asynccontextmanager
class AsyncConnectionPool(BasePool[AsyncConnection[Any]]):
+ _Self = TypeVar("_Self", bound="AsyncConnectionPool")
+
def __init__(
self,
conninfo: str = "",
timeout,
)
- async def __aenter__(self) -> "AsyncConnectionPool":
+ async def __aenter__(self: _Self) -> _Self:
await self.open()
return self