Skip to content

Commit 61a6487

Browse files
Widen _validate_params parameter annotation to object
The annotation was ``Sequence[Any] | None`` but the function's job is to REJECT non-sequence shapes (Mapping, set, frozenset) at runtime. Static-type tools silenced the very inputs the function exists to reject and admitted some it raises on — the worst-of-both-worlds for a runtime type-gate. Test sites carried ``# type: ignore[arg-type]`` for the rejection-path inputs. The dbapi sibling ``_reject_non_sequence_params`` already uses ``params: object`` for the same shape; mirror that. Drop the test-side ``# type: ignore[arg-type]`` comments. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a5fc30c commit 61a6487

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/dqliteclient/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1523,7 +1523,7 @@ async def _bounded_drain() -> None:
15231523
self._invalidation_cause = cause
15241524

15251525
@staticmethod
1526-
def _validate_params(params: Sequence[Any] | None) -> None:
1526+
def _validate_params(params: object) -> None:
15271527
"""Reject non-sequence / scalar-iterable param containers.
15281528
15291529
The qmark paramstyle wants an ordered sequence of positional

tests/test_validate_params_richer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ def test_rejects_memoryview(self) -> None:
3232

3333
def test_rejects_dict(self) -> None:
3434
with pytest.raises(DataError, match="mapping"):
35-
_make_conn()._validate_params({"a": 1}) # type: ignore[arg-type]
35+
_make_conn()._validate_params({"a": 1})
3636

3737
def test_rejects_set(self) -> None:
3838
with pytest.raises(DataError, match="set"):
39-
_make_conn()._validate_params({1, 2, 3}) # type: ignore[arg-type]
39+
_make_conn()._validate_params({1, 2, 3})
4040

4141
def test_rejects_frozenset(self) -> None:
4242
with pytest.raises(DataError, match="set"):
43-
_make_conn()._validate_params(frozenset({1, 2, 3})) # type: ignore[arg-type]
43+
_make_conn()._validate_params(frozenset({1, 2, 3}))
4444

4545
def test_str_and_bytes_still_rejected(self) -> None:
4646
with pytest.raises(DataError, match="str"):

0 commit comments

Comments
 (0)