Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r78377:03f531cb70fe Date: 2015-07-01 13:08 +0200 http://bitbucket.org/pypy/pypy/changeset/03f531cb70fe/
Log: Untested: try to fix an issue where the ctypes callback is invoked in some unexpected thread diff --git a/pypy/module/_rawffi/callback.py b/pypy/module/_rawffi/callback.py --- a/pypy/module/_rawffi/callback.py +++ b/pypy/module/_rawffi/callback.py @@ -27,8 +27,10 @@ callback_ptr = global_counter.get(userdata.addarg) w_callable = callback_ptr.w_callable argtypes = callback_ptr.argtypes + must_leave = False space = callback_ptr.space try: + must_leave = space.threadlocals.try_enter_thread(space) args_w = [None] * len(argtypes) for i in range(len(argtypes)): argtype = argtypes[i] @@ -50,6 +52,8 @@ resshape = letter2tp(space, callback_ptr.result) for i in range(resshape.size): ll_res[i] = '\x00' + if must_leave: + space.threadlocals.leave_thread(space) class W_CallbackPtr(W_DataInstance): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit