[Python-checkins] python/dist/src/Modules threadmodule.c, 2.59, 2.59.2.1

mwh@users.sourceforge.net mwh at users.sourceforge.net
Fri Sep 23 10:14:43 CEST 2005


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

Modified Files:
      Tag: release24-maint
	threadmodule.c 
Log Message:
Backport bugfix:

Fix bug: 

[ 1163563 ] Sub threads execute in restricted mode 

basically by fixing bug 1010677 in a non-broken way. 

Backport candidate. 



Index: threadmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/threadmodule.c,v
retrieving revision 2.59
retrieving revision 2.59.2.1
diff -u -d -r2.59 -r2.59.2.1
--- threadmodule.c	24 Aug 2004 22:24:08 -0000	2.59
+++ threadmodule.c	23 Sep 2005 08:14:40 -0000	2.59.2.1
@@ -425,10 +425,12 @@
 t_bootstrap(void *boot_raw)
 {
 	struct bootstate *boot = (struct bootstate *) boot_raw;
-	PyGILState_STATE gstate;
+	PyThreadState *tstate;
 	PyObject *res;
 
-	gstate = PyGILState_Ensure();
+	tstate = PyThreadState_New(boot->interp);
+
+	PyEval_AcquireThread(tstate);
 	res = PyEval_CallObjectWithKeywords(
 		boot->func, boot->args, boot->keyw);
 	if (res == NULL) {
@@ -453,7 +455,8 @@
 	Py_DECREF(boot->args);
 	Py_XDECREF(boot->keyw);
 	PyMem_DEL(boot_raw);
-	PyGILState_Release(gstate);
+	PyThreadState_Clear(tstate);
+	PyThreadState_DeleteCurrent();
 	PyThread_exit_thread();
 }
 



More information about the Python-checkins mailing list