Skip to content

fix: use context managers for file reads in agent resource loading#3

Open
haosenwang1018 wants to merge 1 commit intoFoundationAgents:mainfrom
haosenwang1018:fix/unclosed-file-handles
Open

fix: use context managers for file reads in agent resource loading#3
haosenwang1018 wants to merge 1 commit intoFoundationAgents:mainfrom
haosenwang1018:fix/unclosed-file-handles

Conversation

@haosenwang1018
Copy link

Replace 4 instances of open().read() with with open() as f: f.read() in agents/recode/agent.py to ensure file descriptors are promptly closed.

open().read() without context manager leaks file descriptors until GC.
Use 'with open()' to ensure prompt cleanup in _load_resources().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant