Remove many blanket try/except clauses.
SF bug [ 751276 ] cPickle doesn't raise error, pickle does (recursiondepth)

Most of the calls to PyErr_Clear() were intended to catch & clear an
attribute error and try something different.  Guard all those cases
with a PyErr_ExceptionMatches() and fail if some other error
occurred.  The other error is likely a bug in the user code.

This is basically the C equivalent of changing "except:" to
"except AttributeError:"
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index b928e47..7ffd979 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -833,8 +833,12 @@
 		*global_name_attr = 0, *name = 0;
 
 	module = PyObject_GetAttrString(global, "__module__");
-	if (module) return module;
-	PyErr_Clear();
+	if (module) 
+		return module;
+	if (PyErr_ExceptionMatches(PyExc_AttributeError))
+		PyErr_Clear();
+	else
+		return NULL;
 
 	if (!( modules_dict = PySys_GetObject("modules")))
 		return NULL;
@@ -846,7 +850,10 @@
 
 		global_name_attr = PyObject_GetAttr(module, global_name);
 		if (!global_name_attr)  {
-			PyErr_Clear();
+			if (PyErr_ExceptionMatches(PyExc_AttributeError))
+				PyErr_Clear();
+			else
+				return NULL;
 			continue;
 		}
 
@@ -1814,7 +1821,10 @@
 		}
 	}
 	else {
-		PyErr_Clear();
+		if (PyErr_ExceptionMatches(PyExc_AttributeError))
+			PyErr_Clear();
+		else
+			goto finally;
 	}
 
 	if (!self->bin) {
@@ -1859,10 +1869,16 @@
 			goto finally;
 	}
 	else {
-		PyErr_Clear();
+		if (PyErr_ExceptionMatches(PyExc_AttributeError))
+			PyErr_Clear();
+		else
+			goto finally;
 
 		if (!( state = PyObject_GetAttr(args, __dict___str)))  {
-			PyErr_Clear();
+			if (PyErr_ExceptionMatches(PyExc_AttributeError))
+				PyErr_Clear();
+			else
+				goto finally;
 			res = 0;
 			goto finally;
 		}
@@ -2141,7 +2157,10 @@
         	PyObject *temp = PyObject_GetAttr(callable, __name___str);
 
 		if (temp == NULL) {
-			PyErr_Clear();
+			if (PyErr_ExceptionMatches(PyExc_AttributeError))
+				PyErr_Clear();
+			else
+				return -1;
 			use_newobj = 0;
 		}
 		else {
@@ -2176,8 +2195,13 @@
 			PyObject *ob_dot_class;
 
 			ob_dot_class = PyObject_GetAttr(ob, __class___str);
-			if (ob_dot_class == NULL)
-				PyErr_Clear();
+			if (ob_dot_class == NULL) {
+				if (PyErr_ExceptionMatches(
+					    PyExc_AttributeError))
+					PyErr_Clear();
+				else
+					return -1;
+			}
 			i = ob_dot_class != cls; /* true iff a problem */
 			Py_XDECREF(ob_dot_class);
 			if (i) {
@@ -2447,7 +2471,10 @@
 			}
 		}
 		else {
-			PyErr_Clear();
+			if (PyErr_ExceptionMatches(PyExc_AttributeError))
+				PyErr_Clear();
+			else
+				goto finally;
 			/* Check for a __reduce__ method. */
 			__reduce__ = PyObject_GetAttr(args, __reduce___str);
 			if (__reduce__ != NULL) {
@@ -3564,7 +3591,7 @@
 			PyObject *__getinitargs__;
 
 			__getinitargs__ = PyObject_GetAttr(cls,
-							   __getinitargs___str);
+						   __getinitargs___str);
 			if (!__getinitargs__)  {
 				/* We have a class with no __getinitargs__,
 				   so bypass usual construction  */
@@ -4253,6 +4280,8 @@
 		Py_DECREF(junk);
 		return 0;
 	}
+	if (!PyErr_ExceptionMatches(PyExc_AttributeError))
+		return -1;
 	PyErr_Clear();
 
 	/* A default __setstate__.  First see whether state embeds a