pathencode: use hashlib.sha1 directly instead of indirecting through util
authorAugie Fackler <raf@durin42.com>
Fri, 10 Jun 2016 00:25:07 -0400
changeset 29340 ae92c3eee88e
parent 29339 a9e010cd66e1
child 29341 0d83ad967bf8
pathencode: use hashlib.sha1 directly instead of indirecting through util
mercurial/pathencode.c
--- a/mercurial/pathencode.c	Fri Jun 10 00:10:34 2016 -0400
+++ b/mercurial/pathencode.c	Fri Jun 10 00:25:07 2016 -0400
@@ -653,24 +653,24 @@
 	PyObject *shaobj, *hashobj;
 
 	if (shafunc == NULL) {
-		PyObject *util, *name = PyString_FromString("mercurial.util");
+		PyObject *hashlib, *name = PyString_FromString("hashlib");
 
 		if (name == NULL)
 			return -1;
 
-		util = PyImport_Import(name);
+		hashlib = PyImport_Import(name);
 		Py_DECREF(name);
 
-		if (util == NULL) {
-			PyErr_SetString(PyExc_ImportError, "mercurial.util");
+		if (hashlib == NULL) {
+			PyErr_SetString(PyExc_ImportError, "hashlib");
 			return -1;
 		}
-		shafunc = PyObject_GetAttrString(util, "sha1");
-		Py_DECREF(util);
+		shafunc = PyObject_GetAttrString(hashlib, "sha1");
+		Py_DECREF(hashlib);
 
 		if (shafunc == NULL) {
 			PyErr_SetString(PyExc_AttributeError,
-					"module 'mercurial.util' has no "
+					"module 'hashlib' has no "
 					"attribute 'sha1'");
 			return -1;
 		}