Skip to content

Commit e6c76e0

Browse files
Lawson-Darrowclaude
andcommitted
Guard isinstance against dead weakref proxies in _dispose_sqlite_engines
gc.get_objects() can include dead weakref proxies, whose isinstance() raises ReferenceError. The check sat outside the try/except, so it escaped and errored the FL tests on Linux (full-dep ubuntu-latest). Move it inside the guard. Signed-off-by: Lawson Darrow <lawson.darrow@gmail.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6171526 commit e6c76e0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/fl/monai_algo/test_fl_monai_algo.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,11 @@ def _dispose_sqlite_engines():
196196
return
197197
gc.collect()
198198
for obj in gc.get_objects():
199-
if not isinstance(obj, Engine):
200-
continue
199+
# gc.get_objects() can include dead weakref proxies, whose isinstance() raises
200+
# ReferenceError, so guard the whole inspection (ReferenceError is an Exception).
201201
try:
202+
if not isinstance(obj, Engine):
203+
continue
202204
url = obj.url
203205
db = url.database if url.get_backend_name() == "sqlite" else None
204206
# the test backends are all files named ``mlflow*.db``; match those only so

0 commit comments

Comments
 (0)