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

refactor to not do too much in ReentrantFileLock.__del__ #2213

Merged
merged 1 commit into from
Oct 23, 2021

Conversation

mattip
Copy link
Contributor

@mattip mattip commented Oct 13, 2021

Thanks for contributing, make sure you address all the checklists (for details on how see

development documentation)!

  • ran the linter to address style issues (tox -e fix_lint)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation

Internal refactor of ReentrantFileLock.__del__ to avoid the _store_lock context if not needed. Also make sure the lock is deleted and set to None in the __exit__ call, so that __del__ now will be a no-op on the happy path.

This came up in #2206 when looking at PyPy failures. Since PyPy uses a non-refcount garbage collector, __del__ can be called much later than on CPython, leaving unneeded locks hanging around.

Copy link
Contributor

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

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

@mattip mattip mentioned this pull request Oct 15, 2021
5 tasks
@gaborbernat gaborbernat merged commit c77c6bc into pypa:main Oct 23, 2021
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.

2 participants