# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 2018-05-19 00:43:01
# Node ID 9aaa74f9eb87c56787aed4fac036784c43e85dbc
# Parent  4fccc73ce2f62fc65985f2da95846749c89db183

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

diff --git a/mercurial/cext/pathencode.c b/mercurial/cext/pathencode.c
--- a/mercurial/cext/pathencode.c
+++ b/mercurial/cext/pathencode.c
@@ -664,7 +664,8 @@ static int sha1hash(char hash[20], const
 		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 @@ static int sha1hash(char hash[20], const
 		if (shafunc == NULL) {
 			PyErr_SetString(PyExc_AttributeError,
 			                "module 'hashlib' has no "
-			                "attribute 'sha1'");
+			                "attribute 'sha1' in pathencode");
 			return -1;
 		}
 	}