Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing dangling file pointers #132

Closed
wants to merge 1 commit into from

Conversation

stefdoerr
Copy link

Hi, I was getting lots of warnings about open file pointers so I thought I'd make this PR to resolve the warnings. Also I assume eventually you might hit OS issues if you open too many files while using propka programmatically through python.

for line in input_:
parameters.parse_line(line)
if not stream:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this be done more cleanly by either checking for duck-typed attributes or simply using isinstance?

@speleo3
Copy link
Collaborator

speleo3 commented Oct 31, 2021

How about solving this with a context manager (and removing the "TODO - convert this to a context manager" comment)? If you don't mind, I can open a pull request with the solution I have in mind, but I'd also be happy to review yours if you want to give it a try.

@intendo
Copy link

intendo commented Oct 31, 2021

How about solving this with a context manager (and removing the "TODO - convert this to a context manager" comment)? If you don't mind, I can open a pull request with the solution I have in mind, but I'd also be happy to review yours if you want to give it a try.

I would vote for the context manager approach.

@stefdoerr
Copy link
Author

Sure feel free to open another PR!

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.

4 participants