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

bpo-30599: Fix test_threaded_import reference leak #2029

Merged
merged 1 commit into from
Jun 10, 2017
Merged

bpo-30599: Fix test_threaded_import reference leak #2029

merged 1 commit into from
Jun 10, 2017

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 9, 2017

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
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)

Copy link
Member

@pitrou pitrou left a comment

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
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