Skip to content

bpo-30599: Fix test_threaded_import reference leak - #2029

Merged
vstinner merged 1 commit into
python:masterfrom
vstinner:mock_random
Jun 10, 2017
Merged

vstinner merged 1 commit into
python:masterfrom
vstinner:mock_random

Conversation

@vstinner

@vstinner vstinner commented Jun 9, 2017

Copy link
Copy Markdown
Member

Mock os.register_at_fork() when importing the random module, since
this function doesn't allow to unregister callbacks and so leaked
memory.

Mock os.register_at_fork() when importing the random module, since
this function doesn't allow to unregister callbacks and so leaked
memory.
@vstinner

Copy link
Copy Markdown
Member Author

Oh, os.register_at_fork() doesn't exist on Windows, so tests failed on Windows. I fixed the test using:

mock.patch('os.register_at_fork', create=True)

@pitrou pitrou 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.

If that's all it takes to suppress the reference leak, then +1 from me. And thanks Victor for fixing this!

@vstinner
vstinner merged commit c5179f6 into python:master Jun 10, 2017
@vstinner
vstinner deleted the mock_random branch June 10, 2017 17:41
@vstinner

Copy link
Copy Markdown
Member Author

Yes, it fixes the reference leak. I prefer to just mock register_at_fork() instead of writing a new module to make sure that we still test the import machinery ;-)

Note: PR merged at the beach on my phone in front of the beach ;-) Thank you Brett for the new workflow! 😀

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.

3 participants