Loading Pyodide runtime…
Reproduction script
import sqlite3
import sys
DROPPED = " <-- setting dropped"
off = sqlite3.connect(":memory:", autocommit=False)
off.execute("PRAGMA foreign_keys = ON")
off.commit()
on = sqlite3.connect(":memory:", autocommit=True)
on.execute("PRAGMA foreign_keys = ON")
off_value = int(off.execute("PRAGMA foreign_keys").fetchone()[0])
on_value = int(on.execute("PRAGMA foreign_keys").fetchone()[0])
disagreement = off_value != on_value
result = {
"python_version": sys.version.split()[0],
"sqlite_version": sqlite3.sqlite_version,
"off_autocommit_fk": off_value,
"on_autocommit_fk": on_value,
"fk_disagreement": disagreement,
}
off_note = DROPPED if off_value == 0 else ""
on_note = DROPPED if on_value == 0 else ""
print("Set PRAGMA foreign_keys = ON on two connections, then read it back:")
print()
print("autocommit".ljust(14) + "foreign_keys".rjust(14))
print("False".ljust(14) + str(off_value).rjust(14) + off_note)
print("True".ljust(14) + str(on_value).rjust(14) + on_note)
print()
if disagreement:
print("The two connections disagree: autocommit=False dropped the PRAGMA.")
else:
print("Both connections agree: the PRAGMA survived on both.")
print("Python " + result["python_version"] + " / SQLite " + result["sqlite_version"])
Baseline output
Initialising…
(pending)
Fix-candidate output
(no fix candidate yet — python/cpython#137205 is still open upstream)