From f5b94d4b289228c4b7a6addd8c9fd6f2a2ad1c64 Mon Sep 17 00:00:00 2001 From: Sense_wang <167664334+haosenwang1018@users.noreply.github.com> Date: Wed, 25 Feb 2026 17:33:56 +0800 Subject: [PATCH] fix: catch ValueError instead of bare except in date parsing (#438) The datetime.strptime() call can only raise ValueError on format mismatch. Bare except catches KeyboardInterrupt and SystemExit, which masks real errors. Co-authored-by: haosenwang1018 --- hindsight-dev/benchmarks/locomo/locomo_benchmark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hindsight-dev/benchmarks/locomo/locomo_benchmark.py b/hindsight-dev/benchmarks/locomo/locomo_benchmark.py index d5391c65..7e47a93c 100644 --- a/hindsight-dev/benchmarks/locomo/locomo_benchmark.py +++ b/hindsight-dev/benchmarks/locomo/locomo_benchmark.py @@ -96,7 +96,7 @@ class LoComoDataset(BenchmarkDataset): try: dt = datetime.strptime(date_string, "%I:%M %p on %d %B, %Y") return dt.replace(tzinfo=timezone.utc) - except: + except ValueError: raise