[pypy-commit] cffi default: Pull request #79 by xwang

arigo pypy.commits at gmail.com
Tue Mar 28 09:43:41 EDT 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r2923:9fe2a9e06094
Date: 2017-03-28 14:36 +0200
http://bitbucket.org/cffi/cffi/changeset/9fe2a9e06094/

Log:	Pull request #79 by xwang

	We can actually call PyThreadState_Delete(), which works without the
	GIL and seems to pass the same tests.

diff --git a/c/misc_thread_common.h b/c/misc_thread_common.h
--- a/c/misc_thread_common.h
+++ b/c/misc_thread_common.h
@@ -29,12 +29,7 @@
     struct cffi_tls_s *tls = (struct cffi_tls_s *)p;
 
     if (tls->local_thread_state != NULL) {
-        /* We need to re-acquire the GIL temporarily to free the
-           thread state.  I hope it is not a problem to do it in
-           a thread-local destructor.
-        */
-        PyEval_RestoreThread(tls->local_thread_state);
-        PyThreadState_DeleteCurrent();
+        PyThreadState_Delete(tls->local_thread_state);
     }
     free(tls);
 }


More information about the pypy-commit mailing list