fix: replace bare except clauses with except Exception

Bare `except:` catches BaseException including KeyboardInterrupt and
SystemExit. Replaced 5 instances with `except Exception:`.
This commit is contained in:
haosenwang1018 2026-02-25 09:19:52 +00:00
parent c7ba252142
commit d5c307ae67
4 changed files with 5 additions and 5 deletions

View File

@ -95,7 +95,7 @@ def download_single_file(index):
if os.path.exists(path):
try:
os.remove(path)
except:
except Exception:
pass
# Try a few times with exponential backoff: 2^attempt seconds
if attempt < max_attempts:

View File

@ -22,7 +22,7 @@ def run_command(cmd):
if result.returncode == 0:
return ""
return None
except:
except Exception:
return None
def get_git_info():
@ -237,7 +237,7 @@ def extract_timestamp(content, prefix):
time_str = line.split(":", 1)[1].strip()
try:
return datetime.datetime.strptime(time_str, "%Y-%m-%d %H:%M:%S")
except:
except Exception:
pass
return None

View File

@ -559,7 +559,7 @@ while True:
if first_step_of_run:
gc.collect() # manually collect a lot of garbage from setup
gc.freeze() # immediately freeze all currently surviving objects and exclude them from GC
gc.disable() # nuclear intervention here: disable GC entirely except:
gc.disable() # nuclear intervention here: disable GC entirely except Exception:
elif step % 5000 == 0: # every 5000 steps...
gc.collect() # manually collect, just to be safe for very, very long runs

View File

@ -468,7 +468,7 @@ while True:
if step == 1:
gc.collect() # manually collect a lot of garbage from setup
gc.freeze() # freeze all currently surviving objects and exclude them from GC
gc.disable() # disable GC entirely except:
gc.disable() # disable GC entirely except Exception:
elif step % 5000 == 0: # every 5000 steps...
gc.collect() # manually collect, just to be safe for very long runs