Patchwork [V2] phases: fix error return with no exception from computephases()

login
register
mail settings
Submitter Yuya Nishihara
Date July 19, 2020, 10:05 a.m.
Message ID <739668fe6ef6d54a2ff9.1595153152@mimosa>
Download mbox | patch
Permalink /patch/46806/
State Accepted
Headers show

Comments

Yuya Nishihara - July 19, 2020, 10:05 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1595063621 -32400
#      Sat Jul 18 18:13:41 2020 +0900
# Node ID 739668fe6ef6d54a2ff93fbad9c18886d3a6aa95
# Parent  bf0637f0915c1365c58d37e55f511323af0dc706
phases: fix error return with no exception from computephases()

PySet_Check() does not set an exception.
Augie Fackler - July 20, 2020, 4:14 p.m.
On Sun, Jul 19, 2020 at 07:05:52PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1595063621 -32400
> #      Sat Jul 18 18:13:41 2020 +0900
> # Node ID 739668fe6ef6d54a2ff93fbad9c18886d3a6aa95
> # Parent  bf0637f0915c1365c58d37e55f511323af0dc706
> phases: fix error return with no exception from computephases()

queued, thanks

Patch

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -757,8 +757,11 @@  static int add_roots_get_min(indexObject
 	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;
+	}
 	iterator = PyObject_GetIter(roots);
 	if (iterator == NULL)
 		return -2;