You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 79d434e
Browse filesBrowse the repository at this point in the historyBrowse files
Three-agent review (architect / code reviewer / skeptic) on the
deferred .md flagged a factual error in the .md's "stay at 1"
case: it claimed stdlib advertises threadsafety=1 as precedent.
Stdlib actually advertises threadsafety=3 since CPython 3.11
(bpo-45613 / gh-31464 made it dynamic via SQLITE_THREADSAFE
mode; serialized = tier 3). The repo's own README:209 already
acknowledged this contradiction.
With the stdlib-precedent leg of the .md's case gone, the
remaining "stay at 1" arguments collapsed:
- Reason 1 (default behavior matches =1): rebutted by stdlib,
which advertises tier 3 while defaulting check_same_thread=True
and enforcing strict per-thread at the Python layer. PEP 249
permits "advertise ceiling, default to floor."
- Reason 2 (cursors are not thread-safe): still true — but that
argues for tier 2 (which doesn't claim cursor sharing), not
tier 1. Tier 3 would be the lie.
- Reason 3 (cross-driver code routes per threadsafety): grep of
installed SA, Django, sqlalchemy-dqlite, dqlite-client, and
dqlite-wire finds zero hits beyond pin tests. The hypothetical
capability-detection consumer doesn't exist.
After Phase 1 + Phase 2 hardening (check_same_thread=False
honored, _op_lock serializes the wire, _state_lock locks
_transaction_owner read-check-reserve + _cursors WeakSet
add/discard), the driver's actual capability ceiling is exactly
PEP 249 tier 2: "Threads may share the module and connections."
Cursors remain per-thread per the documented contract.
Flip the literal in __init__.py:117 and aio/__init__.py:128;
update the comment blocks to explain the ceiling+floor pattern;
update three pin tests (test_module_attributes,
test_aio_module_attributes, sqlalchemy-dqlite/test_dialect) from
==1 to ==2 with rationale comments; update README "PEP 249
Compliance" and "Differences from stdlib sqlite3" sections to
reflect the bump and point at the tier-3 future-work issue.
Tier 3 (cursor sharing — stdlib parity) is tracked separately in
issues/dbapi-threadsafety-tier-3-cursor-sharing-stdlib-parity.md
(next commit). No fundamental architectural blocker — _op_lock
plus GIL atomicity provides the same two layers stdlib uses;
cost is convention + optional per-cursor locking if we want
strict-Tier-3 instead of stdlib's loose-Tier-3.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments