[Python-checkins] python/dist/src/Modules threadmodule.c, 2.56, 2.56.8.1

mhammond at users.sourceforge.net mhammond at users.sourceforge.net
Thu Sep 2 00:31:26 CEST 2004


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22421/Modules

Modified Files:
      Tag: release23-maint
	threadmodule.c 
Log Message:
Backport [ 1010677 ] thread Module Breaks PyGILState_Ensure()
to the 2.3 maint branch.


Index: threadmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/threadmodule.c,v
retrieving revision 2.56
retrieving revision 2.56.8.1
diff -u -d -r2.56 -r2.56.8.1
--- threadmodule.c	16 Jun 2003 18:51:28 -0000	2.56
+++ threadmodule.c	1 Sep 2004 22:31:23 -0000	2.56.8.1
@@ -172,11 +172,10 @@
 t_bootstrap(void *boot_raw)
 {
 	struct bootstate *boot = (struct bootstate *) boot_raw;
-	PyThreadState *tstate;
+	PyGILState_STATE gstate;
 	PyObject *res;
 
-	tstate = PyThreadState_New(boot->interp);
-	PyEval_AcquireThread(tstate);
+	gstate = PyGILState_Ensure();
 	res = PyEval_CallObjectWithKeywords(
 		boot->func, boot->args, boot->keyw);
 	if (res == NULL) {
@@ -201,8 +200,7 @@
 	Py_DECREF(boot->args);
 	Py_XDECREF(boot->keyw);
 	PyMem_DEL(boot_raw);
-	PyThreadState_Clear(tstate);
-	PyThreadState_DeleteCurrent();
+	PyGILState_Release(gstate);
 	PyThread_exit_thread();
 }
 



More information about the Python-checkins mailing list