Author: Armin Rigo <ar...@tunes.org> Branch: static-callback Changeset: r2405:18f25e188dd4 Date: 2015-11-15 12:28 +0100 http://bitbucket.org/cffi/cffi/changeset/18f25e188dd4/
Log: Must setup the threads also when using ffi.call_python(), not just ffi.callback(). diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -5155,6 +5155,13 @@ } infotuple = Py_BuildValue("OOOO", ct, ob, py_rawerr, onerror_ob); Py_DECREF(py_rawerr); + +#ifdef WITH_THREAD + /* We must setup the GIL here, in case the callback is invoked in + some other non-Pythonic thread. This is the same as ctypes. */ + PyEval_InitThreads(); +#endif + return infotuple; } @@ -5200,9 +5207,6 @@ goto error; } assert(closure->user_data == infotuple); -#ifdef WITH_THREAD - PyEval_InitThreads(); -#endif return (PyObject *)cd; error: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit