Skip to content

bpo-38187: Fix reference leak in test_tools - #16233

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

pablogsal merged 1 commit into
python:masterfrom
pablogsal:bpo-38187

Conversation

@pablogsal

@pablogsal pablogsal commented Sep 17, 2019 •

Copy link
Copy Markdown
Member

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.

@ericsnowcurrently ericsnowcurrently left a comment

Copy link
Copy Markdown
Member

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