[Python-checkins] python/dist/src/Modules threadmodule.c, 2.63, 2.64

mwh@users.sourceforge.net mwh at users.sourceforge.net
Mon Jun 20 18:52:59 CEST 2005


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

Modified Files:
	threadmodule.c 
Log Message:
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.63
retrieving revision 2.64
diff -u -d -r2.63 -r2.64
--- threadmodule.c	15 Jun 2005 12:48:40 -0000	2.63
+++ threadmodule.c	20 Jun 2005 16:52:56 -0000	2.64
@@ -413,10 +413,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) {
@@ -441,7 +443,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