Visitar URL original
bpo-38187: Fix reference leak in test_tools by pablogsal · Pull Request #16233 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20260217021921/https://github.com/python/cpython/pull/16233
Skip to content
/ cpython Public

bpo-38187: Fix reference leak in test_tools#16233

Merged
pablogsal merged 1 commit intopython:masterfrom
pablogsal:bpo-38187
Sep 17, 2019
Merged

bpo-38187: Fix reference leak in test_tools#16233
pablogsal merged 1 commit intopython:masterfrom
pablogsal:bpo-38187

Conversation

@pablogsal
Copy link
Member

@pablogsal pablogsal commented Sep 17, 2019 •

This PR fixes the reference leak in test_tools (there is still a problem with some tests when running -R). The problem is that the Variable class in Tools/c-analyzer/c_parser/info.py has a descriptor that stores state in the class-level. Therefore when running the tests multiple times, the state is leaked as there and never released.

Probably this needs a better architecture so we don't need to remember to call Variable._isglobal.instances.clear() after the tests that use Variable, but for now it fixes the leak.

https://bugs.python.org/issue38187

This one was tricky to find.

Copy link
Member

@ericsnowcurrently ericsnowcurrently left a comment

Choose a reason for hiding this comment

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

This is fine as a quick fix. I'll work on fixing the Slot class, probably using a WeakKeyDictionary.

@pablogsal pablogsal merged commit 6fbc924 into python:master Sep 17, 2019
@pablogsal pablogsal deleted the bpo-38187 branch September 17, 2019 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants