##// END OF EJS Templates
parsers: do not cache RevlogError type (issue4451)...
Gregory Szorc -
r25561:50a6c3c5 stable
parent child Browse files
Show More
@@ -1483,41 +1483,34 b' static int index_find_node(indexObject *'
1483 return -2;
1483 return -2;
1484 }
1484 }
1485
1485
1486 static PyObject *raise_revlog_error(void)
1486 static void raise_revlog_error(void)
1487 {
1487 {
1488 static PyObject *errclass;
1488 PyObject *mod = NULL, *dict = NULL, *errclass = NULL;
1489 PyObject *mod = NULL, *errobj;
1490
1491 if (errclass == NULL) {
1492 PyObject *dict;
1493
1489
1494 mod = PyImport_ImportModule("mercurial.error");
1490 mod = PyImport_ImportModule("mercurial.error");
1495 if (mod == NULL)
1491 if (mod == NULL) {
1496 goto classfail;
1492 goto cleanup;
1493 }
1497
1494
1498 dict = PyModule_GetDict(mod);
1495 dict = PyModule_GetDict(mod);
1499 if (dict == NULL)
1496 if (dict == NULL) {
1500 goto classfail;
1497 goto cleanup;
1498 }
1499 Py_INCREF(dict);
1501
1500
1502 errclass = PyDict_GetItemString(dict, "RevlogError");
1501 errclass = PyDict_GetItemString(dict, "RevlogError");
1503 if (errclass == NULL) {
1502 if (errclass == NULL) {
1504 PyErr_SetString(PyExc_SystemError,
1503 PyErr_SetString(PyExc_SystemError,
1505 "could not find RevlogError");
1504 "could not find RevlogError");
1506 goto classfail;
1505 goto cleanup;
1507 }
1508 Py_INCREF(errclass);
1509 Py_DECREF(mod);
1510 }
1506 }
1511
1507
1512 errobj = PyObject_CallFunction(errclass, NULL);
1508 /* value of exception is ignored by callers */
1513 if (errobj == NULL)
1509 PyErr_SetString(errclass, "RevlogError");
1514 return NULL;
1515 PyErr_SetObject(errclass, errobj);
1516 return errobj;
1517
1510
1518 classfail:
1511 cleanup:
1512 Py_XDECREF(dict);
1519 Py_XDECREF(mod);
1513 Py_XDECREF(mod);
1520 return NULL;
1521 }
1514 }
1522
1515
1523 static PyObject *index_getitem(indexObject *self, PyObject *value)
1516 static PyObject *index_getitem(indexObject *self, PyObject *value)
General Comments 0
You need to be logged in to leave comments. Login now