[Python-3000-checkins] r64686 - in python/branches/py3k: Modules/nismodule.c

amaury.forgeotdarc python-3000-checkins at python.org
Thu Jul 3 01:44:19 CEST 2008


Author: amaury.forgeotdarc
Date: Thu Jul  3 01:44:19 2008
New Revision: 64686

Log:
Merged revisions 64685 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r64685 | amaury.forgeotdarc | 2008-07-03 01:40:28 +0200 (Thu, 03 Jul 2008) | 3 lines
  
  Try a blind fix to nismodule which fails on the solaris10 3.0 buildbot:
  the GIL must be re-acquired in the callback function
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Modules/nismodule.c

Modified: python/branches/py3k/Modules/nismodule.c
==============================================================================
--- python/branches/py3k/Modules/nismodule.c	(original)
+++ python/branches/py3k/Modules/nismodule.c	Thu Jul  3 01:44:19 2008
@@ -98,6 +98,7 @@
 struct ypcallback_data {
 	PyObject	*dict;
 	int			fix;
+	PyThreadState *state;
 };
 
 static int
@@ -109,6 +110,7 @@
 		PyObject *val;
 		int err;
 
+		PyEval_RestoreThread(indata->state);
 		if (indata->fix) {
 		    if (inkeylen > 0 && inkey[inkeylen-1] == '\0')
 			inkeylen--;
@@ -127,10 +129,11 @@
 		err = PyDict_SetItem(indata->dict, key, val);
 		Py_DECREF(key);
 		Py_DECREF(val);
-		if (err != 0) {
+		if (err != 0)
 			PyErr_Clear();
-			return 1;
-		}
+		indata->state = PyEval_SaveThread();
+		if (err != 0)
+		  	return 1;
 		return 0;
 	}
 	return 1;
@@ -206,9 +209,9 @@
 	data.dict = dict;
 	map = nis_mapname (map, &data.fix);
 	cb.data = (char *)&data;
-	Py_BEGIN_ALLOW_THREADS
+	data.state = PyEval_SaveThread();
 	err = yp_all (domain, map, &cb);
-	Py_END_ALLOW_THREADS
+	PyEval_RestoreThread(data.state);
 	if (err != 0) {
 		Py_DECREF(dict);
 		return nis_error(err);


More information about the Python-3000-checkins mailing list