Skip to content

Commit 52b649d

Browse files
Spell out the context-manager dunder argument types
Replace *args: Any catch-alls on __aexit__ in DqliteConnection and ConnectionPool with the typed three-argument signature (exc_type, exc_val, exc_tb). Runtime behaviour unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c73d8e2 commit 52b649d

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/dqliteclient/connection.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import math
66
from collections.abc import AsyncIterator, Awaitable, Callable, Sequence
77
from contextlib import asynccontextmanager
8+
from types import TracebackType
89
from typing import Any
910

1011
from dqliteclient.exceptions import (
@@ -225,7 +226,12 @@ async def __aenter__(self) -> "DqliteConnection":
225226
await self.connect()
226227
return self
227228

228-
async def __aexit__(self, *args: Any) -> None:
229+
async def __aexit__(
230+
self,
231+
exc_type: type[BaseException] | None,
232+
exc_val: BaseException | None,
233+
exc_tb: TracebackType | None,
234+
) -> None:
229235
await self.close()
230236

231237
def _ensure_connected(self) -> tuple[DqliteProtocol, int]:

src/dqliteclient/pool.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import logging
66
from collections.abc import AsyncIterator, Sequence
77
from contextlib import asynccontextmanager
8+
from types import TracebackType
89
from typing import Any
910

1011
from dqliteclient.cluster import ClusterClient
@@ -567,5 +568,10 @@ async def __aenter__(self) -> "ConnectionPool":
567568
await self.initialize()
568569
return self
569570

570-
async def __aexit__(self, *args: Any) -> None:
571+
async def __aexit__(
572+
self,
573+
exc_type: type[BaseException] | None,
574+
exc_val: BaseException | None,
575+
exc_tb: TracebackType | None,
576+
) -> None:
571577
await self.close()

0 commit comments

Comments
 (0)