##// END OF EJS Templates
pathencode: use hashlib.sha1 directly instead of indirecting through util
Augie Fackler -
r29340:ae92c3ee default
parent child Browse files
Show More
@@ -653,24 +653,24 static int sha1hash(char hash[20], const
653 PyObject *shaobj, *hashobj;
653 PyObject *shaobj, *hashobj;
654
654
655 if (shafunc == NULL) {
655 if (shafunc == NULL) {
656 PyObject *util, *name = PyString_FromString("mercurial.util");
656 PyObject *hashlib, *name = PyString_FromString("hashlib");
657
657
658 if (name == NULL)
658 if (name == NULL)
659 return -1;
659 return -1;
660
660
661 util = PyImport_Import(name);
661 hashlib = PyImport_Import(name);
662 Py_DECREF(name);
662 Py_DECREF(name);
663
663
664 if (util == NULL) {
664 if (hashlib == NULL) {
665 PyErr_SetString(PyExc_ImportError, "mercurial.util");
665 PyErr_SetString(PyExc_ImportError, "hashlib");
666 return -1;
666 return -1;
667 }
667 }
668 shafunc = PyObject_GetAttrString(util, "sha1");
668 shafunc = PyObject_GetAttrString(hashlib, "sha1");
669 Py_DECREF(util);
669 Py_DECREF(hashlib);
670
670
671 if (shafunc == NULL) {
671 if (shafunc == NULL) {
672 PyErr_SetString(PyExc_AttributeError,
672 PyErr_SetString(PyExc_AttributeError,
673 "module 'mercurial.util' has no "
673 "module 'hashlib' has no "
674 "attribute 'sha1'");
674 "attribute 'sha1'");
675 return -1;
675 return -1;
676 }
676 }
General Comments 0
You need to be logged in to leave comments. Login now