Skip to content

Bare except: and file handle leaks in multiple modules #516

Description

@xuuuuuuu9

Description

Found multiple bare except: patterns that swallow KeyboardInterrupt and SystemExit, and file handle leaks from missing with context managers.

Issues fixed

Bare except: (5 locations in 3 files):

  • python_executor.py: 3 bare except: in code execution path — makes the process unkillable when hanging
  • format_utils.py: 1 bare except: — swallows KeyboardInterrupt during title extraction
  • modeling_flash_llama.py: 1 bare except: — flash-attn version fallback

File handle leaks (2 locations in 1 file):

  • mathbook_question_extract.py: json.load(open(...)) without context manager — file descriptors not closed

Fix

  • Changed all bare except: to except Exception: or except AttributeError: (more specific)
  • Changed json.load(open(...)) to with open(...) as f: json.load(f)

[See PR for details]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions