summaryrefslogtreecommitdiffstats
path: root/Modules/nismodule.c
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-02 23:44:19 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-07-02 23:44:19 (GMT)
commit451a356f11d3ed498a359f94d85a7df5d6a2a843 (patch)
tree486ef293769a070758df15c4d7e725ac8e695fdc /Modules/nismodule.c
parent4b02c5a8545cf6bc7f223ba18f72d70670d8110d (diff)
downloadcpython-451a356f11d3ed498a359f94d85a7df5d6a2a843.zip
cpython-451a356f11d3ed498a359f94d85a7df5d6a2a843.tar.gz
cpython-451a356f11d3ed498a359f94d85a7df5d6a2a843.tar.bz2
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 ........
Diffstat (limited to 'Modules/nismodule.c')
-rw-r--r--Modules/nismodule.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/Modules/nismodule.c b/Modules/nismodule.c
index 3af394d..c2646eb 100644
--- a/Modules/nismodule.c
+++ b/Modules/nismodule.c
@@ -98,6 +98,7 @@ typedef int (*foreachfunc)(int, char *, int, char *, int, char *);
struct ypcallback_data {
PyObject *dict;
int fix;
+ PyThreadState *state;
};
static int
@@ -109,6 +110,7 @@ nis_foreach (int instatus, char *inkey, int inkeylen, char *inval,
PyObject *val;
int err;
+ PyEval_RestoreThread(indata->state);
if (indata->fix) {
if (inkeylen > 0 && inkey[inkeylen-1] == '\0')
inkeylen--;
@@ -127,10 +129,11 @@ nis_foreach (int instatus, char *inkey, int inkeylen, char *inval,
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 @@ nis_cat (PyObject *self, PyObject *args, PyObject *kwdict)
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);