Author: Amaury Forgeot d'Arc <amaur...@gmail.com> Branch: py3k Changeset: r59257:24189046c0ca Date: 2012-12-02 14:38 +0100 http://bitbucket.org/pypy/pypy/changeset/24189046c0ca/
Log: Fix os.fork() when run with bin/py.py with cpyext module enabled: when interpreted, PyThread_ReInitTLS() is the one from the host CPython, and not the one provided by cpyext. Funny things will happen then, errors like "RuntimeError: not holding the import lock" diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py --- a/pypy/module/cpyext/api.py +++ b/pypy/module/cpyext/api.py @@ -650,8 +650,12 @@ lambda space: init_capsule(), ]) from pypy.module.posix.interp_posix import add_fork_hook - reinit_tls = rffi.llexternal('PyThread_ReInitTLS', [], lltype.Void, - compilation_info=eci) + if we_are_translated(): + reinit_tls = rffi.llexternal('PyThread_ReInitTLS', [], lltype.Void, + compilation_info=eci) + else: + reinit_tls = rffi.llexternal('PyPyThread_ReInitTLS', [], lltype.Void, + compilation_info=eci) add_fork_hook('child', reinit_tls) def init_function(func): _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit