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 <haosenwang1018@users.noreply.github.com>
This commit is contained in:
Sense_wang 2026-02-25 17:33:56 +08:00 committed by GitHub
parent 58f2de70fb
commit f5b94d4b28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -96,7 +96,7 @@ class LoComoDataset(BenchmarkDataset):
try: try:
dt = datetime.strptime(date_string, "%I:%M %p on %d %B, %Y") dt = datetime.strptime(date_string, "%I:%M %p on %d %B, %Y")
return dt.replace(tzinfo=timezone.utc) return dt.replace(tzinfo=timezone.utc)
except: except ValueError:
raise raise