Message295431
> The leak was introduced by the commit 346cbd351ee0dd3ab9cb9f0e4cb625556707877e.
This commit "bpo-16500: Allow registering at-fork handlers" adds the following code to Lib/random.py:
+if hasattr(_os, "fork"):
+ _os.register_at_fork(_inst.seed, when='child')
test_threaded_import creates fresh instance of the random module and so os.register_at_fork() is called multiple time with multiple different callbacks.
The problem is that it's not currently possible to remove callbacks. It would be nice to be able to unregister callbacks, at least a private for unit tests.
The minimum would be a os.unregister_at_fork() function.
I would prefer to have get/set functions to be able to restore callbacks once tests complete, but also to detect when an unexpected callback was registered. For example, write a new test in Lib/test/libregrtest/save_env.py for regrtest.
See also bpo-16500 which added the new API. |
|
Date |
User |
Action |
Args |
2017-06-08 12:35:21 | vstinner | set | recipients:
+ vstinner, pitrou, serhiy.storchaka |
2017-06-08 12:35:21 | vstinner | set | messageid: <1496925321.07.0.638576908343.issue30599@psf.upfronthosting.co.za> |
2017-06-08 12:35:21 | vstinner | link | issue30599 messages |
2017-06-08 12:35:20 | vstinner | create | |
|