mercurial/cext/pathencode.c
changeset 38113 f7a0398996ad
parent 38056 9aaa74f9eb87
child 38702 992e108212a9
equal deleted inserted replaced
38112:d7cecea0b254 38113:f7a0398996ad
   653 {
   653 {
   654 	static PyObject *shafunc;
   654 	static PyObject *shafunc;
   655 	PyObject *shaobj, *hashobj;
   655 	PyObject *shaobj, *hashobj;
   656 
   656 
   657 	if (shafunc == NULL) {
   657 	if (shafunc == NULL) {
   658 		PyObject *hashlib, *name = PyBytes_FromString("hashlib");
   658 		PyObject *hashlib = PyImport_ImportModule("hashlib");
   659 
       
   660 		if (name == NULL)
       
   661 			return -1;
       
   662 
       
   663 		hashlib = PyImport_ImportModule("hashlib");
       
   664 		Py_DECREF(name);
       
   665 
       
   666 		if (hashlib == NULL) {
   659 		if (hashlib == NULL) {
   667 			PyErr_SetString(PyExc_ImportError,
   660 			PyErr_SetString(PyExc_ImportError,
   668 			                "pathencode failed to find hashlib");
   661 			                "pathencode failed to find hashlib");
   669 			return -1;
   662 			return -1;
   670 		}
   663 		}