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

2010-08-11 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Wed, Aug 11, 2010 at 10:56 PM, Alex Roitman wrote: > > 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, on

[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 Alexander Belopolsky
Alexander Belopolsky added the comment: > How can this be worked around, short of placing the fork() > in the main module? Why wouldn't you place the fork() call in a function? -- nosy: +belopolsky ___ Python tracker

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

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

2010-08-11 Thread Brett Cannon
Brett Cannon added the comment: Without looking closer at it, don't do that. =) -- ___ Python tracker ___ ___ Python-bugs-list mailing

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

2010-08-11 Thread R. David Murray
R. David Murray added the comment: This may be a case of "don't do that". Starting a new thread or process during import (ie: while the import lock is held) is dangerous. Nosying Brett, since he'll know the real story. -- nosy: +brett.cannon, r.david.murray

[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" == Running the same module as main work