Skip to content

Commit 66899ff

Browse files
GeneralK1ngtomasr8
andauthored
optimize(code): update Lib/dbm/sqlite3.py
Co-authored-by: Tomas R. <[email protected]>
1 parent 775683e commit 66899ff

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Lib/dbm/sqlite3.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,10 @@ def __init__(self, path, /, *, flag, mode):
5959

6060
# We use the URI format when opening the database.
6161
uri = _normalize_uri(path)
62+
uri = f"{uri}?mode={flag}"
6263
if flag == "ro":
6364
# Add immutable=1 to allow read-only SQLite access even if wal/shm missing
64-
uri = f"{uri}?mode={flag}&immutable=1"
65-
else:
66-
uri = f"{uri}?mode={flag}"
65+
uri += "&immutable=1"
6766

6867
try:
6968
self._cx = sqlite3.connect(uri, autocommit=True, uri=True)

0 commit comments

Comments
 (0)