diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
index f93a4e3d35ab4c241d00fe24ae858f8e9f727ad2_bWVyY3VyaWFsL2NleHQvcmV2bG9nLmM=..211063648b29b1e7d9d5c9fbacd777b17c73f063_bWVyY3VyaWFsL2NleHQvcmV2bG9nLmM= 100644
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -757,5 +757,7 @@
 	int rev, minrev = -1;
 	char *node;
 
-	if (!PySet_Check(roots))
+	if (!PySet_Check(roots)) {
+		PyErr_SetString(PyExc_TypeError,
+		                "roots must be a set of nodes");
 		return -2;
@@ -761,4 +763,5 @@
 		return -2;
+	}
 	iterator = PyObject_GetIter(roots);
 	if (iterator == NULL)
 		return -2;