Restore GIL in nis_cat in case of error.
diff --git a/Misc/NEWS b/Misc/NEWS
index 8a1d414..59ad9d3 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -57,6 +57,8 @@
Extensions
----------
+- Restore GIL in nis_cat in case of error.
+
- Issue #665761: ``functools.reduce()`` will no longer mask exceptions
other than ``TypeError`` raised by the iterator argument.
diff --git a/Modules/nismodule.c b/Modules/nismodule.c
index 16c7b81..d75af5d 100644
--- a/Modules/nismodule.c
+++ b/Modules/nismodule.c
@@ -124,6 +124,7 @@
PyErr_Clear();
Py_XDECREF(key);
Py_XDECREF(val);
+ indata->state = PyEval_SaveThread();
return 1;
}
err = PyDict_SetItem(indata->dict, key, val);