From 8b3f6412b2ad106738e6b110728dc9768a1d56f4 Mon Sep 17 00:00:00 2001 From: haosenwang1018 Date: Wed, 25 Feb 2026 04:35:39 +0000 Subject: [PATCH] fix: replace bare except with except Exception in thread_safe_dict_segment The bare except in acquire_write() catches KeyboardInterrupt and SystemExit, which could leave the lock in an inconsistent state. Using except Exception ensures system-level exceptions propagate. --- src/memos/memos_tools/thread_safe_dict_segment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/memos/memos_tools/thread_safe_dict_segment.py b/src/memos/memos_tools/thread_safe_dict_segment.py index c1c10e3e1..bf918889f 100644 --- a/src/memos/memos_tools/thread_safe_dict_segment.py +++ b/src/memos/memos_tools/thread_safe_dict_segment.py @@ -71,7 +71,7 @@ def acquire_write(self) -> bool: self._waiting_writers -= 1 self._last_write_time = time.time() return True - except: + except Exception: self._waiting_writers -= 1 raise