Skip to content

Refactor file I/O to use context managers and fix bare excepts #12

@avinxshKD

Description

@avinxshKD

I've been digging through mkconcore.py and concore.py, and I noticed we're opening a lot of files without context managers (with statements). While CPython's GC usually handles cleanup, it's not guaranteed and can lead to file descriptor leaks, especially during complex I/O operations or if the script crashes.

Also, there are several except: blocks that catch everything (including KeyboardInterrupt and SystemExit). This makes debugging a pain because you can't easily kill the process if it hangs in a loop, and it masks actual errors we might want to see.

I'd like to refactor these file operations to use with open(...) as f: and narrow down the exception handling to specific errors like IOError or FileNotFoundError. It's a bit of housekeeping but will make the codebase much more robust.

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