Files
Joseph MaglyandClaude Opus 5.5 08a04e3bd4 fix(bayesian): close Optuna SQLite storage and backup connections
On Python 3.13+, an sqlite3 connection that is garbage-collected
without being closed raises ResourceWarning, which the project's
filterwarnings=error turns into test failures. pyproject declares
requires-python >=3.11 with no upper bound, so these versions must work.

- The durable study's RDBStorage is now owned by an ExitStack in both
  public entry points and closed (remove_session, then engine.dispose)
  on success, failure and cancellation.
- _atomic_sqlite_backup closes both handles with contextlib.closing;
  sqlite3's own context manager only ends the transaction.
- Two tests that reopened or connected to study databases now close
  their handles.
- New regression test tracks every sqlite3 handle opened during a real
  durable study (success, failure, KeyboardInterrupt) and the backup,
  asserting all are closed independent of the 3.13+ warning.

Storage URLs, file names, snapshots and resume behaviour are unchanged;
as with any edit to this module, the study identity (which hashes the
module source) changes, so pre-existing durable studies start fresh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 17:43:05 -05:00
..
2026-03-05 00:50:44 -08:00
2026-03-05 00:50:44 -08:00
2026-03-05 00:50:44 -08:00
2026-03-05 00:50:44 -08:00
2026-08-19 22:25:38 -04:00
2026-03-05 00:50:44 -08:00
2026-03-05 00:50:44 -08:00
2026-08-19 21:38:19 -04:00
2026-03-05 00:50:44 -08:00
2026-03-05 00:50:44 -08:00