Merge revision 71222 from trunk: #5615: make it possible to configure --without-threads again.
diff --git a/Objects/object.c b/Objects/object.c
index 2cb71dc..14cacb3 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -349,11 +349,17 @@
if (op == NULL)
fprintf(stderr, "NULL\n");
else {
+#ifdef WITH_THREAD
PyGILState_STATE gil;
+#endif
fprintf(stderr, "object : ");
+#ifdef WITH_THREAD
gil = PyGILState_Ensure();
+#endif
(void)PyObject_Print(op, stderr, 0);
+#ifdef WITH_THREAD
PyGILState_Release(gil);
+#endif
/* XXX(twouters) cast refcount to long until %zd is
universally available */
fprintf(stderr, "\n"