changeset 38089:9aaa74f9eb87

pathencode: improve error messages slightly Both of these are conditions we should never hit, so we can afford to be more verbose to make debugging less baffling. Differential Revision: https://phab.mercurial-scm.org/D3589
author Augie Fackler <augie@google.com>
date Fri, 18 May 2018 20:43:01 -0400
parents 4fccc73ce2f6
children f0ee627162f4
files mercurial/cext/pathencode.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cext/pathencode.c	Fri May 18 20:42:31 2018 -0400
+++ b/mercurial/cext/pathencode.c	Fri May 18 20:43:01 2018 -0400
@@ -664,7 +664,8 @@
 		Py_DECREF(name);
 
 		if (hashlib == NULL) {
-			PyErr_SetString(PyExc_ImportError, "hashlib");
+			PyErr_SetString(PyExc_ImportError,
+			                "pathencode failed to find hashlib");
 			return -1;
 		}
 		shafunc = PyObject_GetAttrString(hashlib, "sha1");
@@ -673,7 +674,7 @@
 		if (shafunc == NULL) {
 			PyErr_SetString(PyExc_AttributeError,
 			                "module 'hashlib' has no "
-			                "attribute 'sha1'");
+			                "attribute 'sha1' in pathencode");
 			return -1;
 		}
 	}