[pypy-issue] [issue1323] subprocess.call, threading.Thread and OS X does not complete

Kenny Levinsen tracker at bugs.pypy.org
Thu Nov 15 23:43:13 CET 2012

Kenny Levinsen <kennylevinsen at gmail.com> added the comment:

In the following code:

def fork(space):
    run_fork_hooks('before', space)

        pid = os.fork()
        if pid == 0:
            print "Wee, a child was born!"
    except OSError, e:
            run_fork_hooks('parent', space)
            # Don't clobber the OSError if the fork failed
        raise wrap_oserror(space, e)

    if pid == 0:
        print "Begin child hooks"
        run_fork_hooks('child', space)
        print "Child hooks completed"
        run_fork_hooks('parent', space)
        print "Parent hooks completed"

    return space.wrap(pid)

Prints the following when forking from a thread:
Wee, a child was!
Parent hooks completed

Whereas, without threads, it prints:
Parent hooks completed
Wee, a child was born!
Begin child hooks
Child hooks completed

... The result: I'm having fun with the generated C, trying to get what's going 

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list