Author: Armin Rigo <ar...@tunes.org> Branch: py3.5 Changeset: r89949:9ba6ab77fd29 Date: 2017-02-05 19:05 +0100 http://bitbucket.org/pypy/pypy/changeset/9ba6ab77fd29/
Log: hg merge default diff --git a/pypy/module/cpyext/pystate.py b/pypy/module/cpyext/pystate.py --- a/pypy/module/cpyext/pystate.py +++ b/pypy/module/cpyext/pystate.py @@ -1,6 +1,7 @@ from pypy.module.cpyext.api import ( cpython_api, generic_cpy_call, CANNOT_FAIL, CConfig, cpython_struct) from pypy.module.cpyext.pyobject import PyObject, Py_DecRef, make_ref, from_ref +from pypy.interpreter.error import OperationError from rpython.rtyper.lltypesystem import rffi, lltype from rpython.rlib import rthread from rpython.rlib.objectmodel import we_are_translated @@ -317,3 +318,16 @@ be held. The thread state must have been reset with a previous call to PyThreadState_Clear().""" +@cpython_api([], lltype.Void) +def PyOS_AfterFork(space): + """Function to update some internal state after a process fork; this should be + called in the new process if the Python interpreter will continue to be used. + If a new executable is loaded into the new process, this function does not need + to be called.""" + if not space.config.translation.thread: + return + from pypy.module.thread import os_thread + try: + os_thread.reinit_threads(space) + except OperationError as e: + e.write_unraisable(space, "PyOS_AfterFork()") diff --git a/pypy/module/cpyext/stubs.py b/pypy/module/cpyext/stubs.py --- a/pypy/module/cpyext/stubs.py +++ b/pypy/module/cpyext/stubs.py @@ -1468,14 +1468,6 @@ one of the strings '<stdin>' or '???'.""" raise NotImplementedError -@cpython_api([], lltype.Void) -def PyOS_AfterFork(space): - """Function to update some internal state after a process fork; this should be - called in the new process if the Python interpreter will continue to be used. - If a new executable is loaded into the new process, this function does not need - to be called.""" - raise NotImplementedError - @cpython_api([], rffi.INT_real, error=CANNOT_FAIL) def PyOS_CheckStack(space): """Return true when the interpreter runs out of stack space. This is a reliable _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit