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

DM-11771: Close files that have been left hanging #66

Merged
merged 6 commits into from Sep 2, 2017

Conversation

timj
Copy link
Member

@timj timj commented Sep 1, 2017

No description provided.

Copy link
Member Author

@timj timj left a comment

Choose a reason for hiding this comment

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

Looks good to me. I do wonder whether all of those del calls are needed (especially the 3 in the middle)

@@ -413,16 +439,19 @@ def test(self):
registryA = butler._repos.inputs()[0].repo._mapper.registry
registryB = butler._repos.outputs()[0].repo._mapper.registry
self.assertEqual(id(registryA), id(registryB))
del registryA
del registryB
Copy link
Member Author

Choose a reason for hiding this comment

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

I am guessing that these three del calls are not needed because the assignment later will overwrite them.


del registryA
del registryB
del butler
Copy link
Member Author

Choose a reason for hiding this comment

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

Do these make a difference now? The variables will disappear at end of scope and the gc.collect() will clean up.

with open(os.path.join(self.repoARoot, 'registry.sqlite3'), 'w') as f:
f.write('123')
self._createRegistry(os.path.join(self.repoARoot, 'registry.sqlite3'))
del butler
Copy link
Member Author

Choose a reason for hiding this comment

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

This might be needed, but keeping it means that the linter won't complain about butler only being used once.

@n8pease n8pease merged commit aa61098 into master Sep 2, 2017
@ktlim ktlim deleted the tickets/DM-11771 branch August 25, 2018 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants