Alex Roitman <rsh...@gmail.com> added the comment:

gregory.p.smith: This is my use case: we had the following situation with the 
test scripts at work.  Each script is required to import TestApi module in 
order to run the tests.  That module in turn imported the module that forks, 
and in the parent waits for the child to exit, then kills all child's children 
processes.  That way tests don't leave any processes behind.

So any script that imported the cleanup module, whether directly or via another 
module, had this cleanup functionality "for free". One workaround for this 
issue would be to change all existing test scripts to call the cleanup 
function, instead of the cleanup module calling it at the module level.

I can see your reservations about forking/starting threads during import, but 
it seems like it either should work or it should be disallowed.  The thing is, 
the actual import is working fine with the fork() call, it's releasing the lock 
that is messed up, because it was not initialized correctly after the fork.  
The patch attached by ncoghlan looks good though.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9573>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to