mercurial/parsers.c
branchstable
changeset 25561 50a6c3c55db1
parent 24879 b3142ea2a0d4
child 25580 a69983942fb4
--- a/mercurial/parsers.c	Mon Jun 08 18:14:22 2015 +0900
+++ b/mercurial/parsers.c	Fri Jun 12 14:43:59 2015 -0700
@@ -1483,41 +1483,34 @@
 	return -2;
 }
 
-static PyObject *raise_revlog_error(void)
+static void raise_revlog_error(void)
 {
-	static PyObject *errclass;
-	PyObject *mod = NULL, *errobj;
-
-	if (errclass == NULL) {
-		PyObject *dict;
-
-		mod = PyImport_ImportModule("mercurial.error");
-		if (mod == NULL)
-			goto classfail;
+	PyObject *mod = NULL, *dict = NULL, *errclass = NULL;
 
-		dict = PyModule_GetDict(mod);
-		if (dict == NULL)
-			goto classfail;
-
-		errclass = PyDict_GetItemString(dict, "RevlogError");
-		if (errclass == NULL) {
-			PyErr_SetString(PyExc_SystemError,
-					"could not find RevlogError");
-			goto classfail;
-		}
-		Py_INCREF(errclass);
-		Py_DECREF(mod);
+	mod = PyImport_ImportModule("mercurial.error");
+	if (mod == NULL) {
+		goto cleanup;
 	}
 
-	errobj = PyObject_CallFunction(errclass, NULL);
-	if (errobj == NULL)
-		return NULL;
-	PyErr_SetObject(errclass, errobj);
-	return errobj;
+	dict = PyModule_GetDict(mod);
+	if (dict == NULL) {
+		goto cleanup;
+	}
+	Py_INCREF(dict);
 
-classfail:
+	errclass = PyDict_GetItemString(dict, "RevlogError");
+	if (errclass == NULL) {
+		PyErr_SetString(PyExc_SystemError,
+				"could not find RevlogError");
+		goto cleanup;
+	}
+
+	/* value of exception is ignored by callers */
+	PyErr_SetString(errclass, "RevlogError");
+
+cleanup:
+	Py_XDECREF(dict);
 	Py_XDECREF(mod);
-	return NULL;
 }
 
 static PyObject *index_getitem(indexObject *self, PyObject *value)