[issue9573] importing a module that executes fork() raises RuntimeError

2010-08-17 Thread Alex Roitman
Alex Roitman added the comment: Will starting a thread while in import also be disallowed? If so, issue 7242 will also become moot... -- ___ Python tracker <http://bugs.python.org/issue9

[issue9573] importing a module that executes fork() raises RuntimeError

2010-08-17 Thread Alex Roitman
Alex Roitman added the comment: I already worked around this for my use case. For the future, it would be nice if fork() raised an exception if called during the import, and if the documentation mentioned that forking while in import is not allowed

[issue9573] importing a module that executes fork() raises RuntimeError

2010-08-17 Thread Alex Roitman
Alex Roitman 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

[issue9573] importing a module that executes fork() raises RuntimeError

2010-08-11 Thread Alex Roitman
Alex Roitman added the comment: 1. If fork should not be called during import, it could raise an exception when invoked from import. But it does not. Is that a bug then? BTW, fork during import worked with python 2.4 just fine. 2. The whole issue7242 was devoted to work out import locks

[issue9573] imporing a module that executes fork() raises RuntimeError

2010-08-11 Thread Alex Roitman
Alex Roitman added the comment: I can place it in a function. But if I execute that function from anything other than main module, the fork() will be called while import lock is held, one way or another. It will just happen in another module. So what

[issue9573] imporing a module that executes fork() raises RuntimeError

2010-08-11 Thread Alex Roitman
Alex Roitman added the comment: I guess I am missing something here. In a complex program, everything will be executed in some module or another. Consequently, the module that contains the fork() call will cause the interpreter to quit. How can this be worked around, short of placing the

[issue9573] imporing a module that executes fork() raises RuntimeError

2010-08-11 Thread Alex Roitman
New submission from Alex Roitman : Importing the module with the following contents results in RuntimeError: == import os pid = os.fork() if pid == 0: print "In the child" else: print "In the parent" print "Done\n" == R