From patchwork Mon Oct 20 02:56:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1, of, 2, stable] WHAT: PyExc_TypeError in parsers.c is lost - use PyExc_ValueError instead From: Mads Kiilerich X-Patchwork-Id: 6414 Message-Id: <2ee3d9d0bc7be9b67f5f.1413773809@localhost.localdomain> To: mercurial-devel@selenic.com Date: Mon, 20 Oct 2014 04:56:49 +0200 # HG changeset patch # User Mads Kiilerich # Date 1413773777 -7200 # Mon Oct 20 04:56:17 2014 +0200 # Branch stable # Node ID 2ee3d9d0bc7be9b67f5f5f05db6faa2a9d927e2a # Parent c1ae0b2c1719f56b906472efea8b20ca0774c968 WHAT: PyExc_TypeError in parsers.c is lost - use PyExc_ValueError instead This gives a reasonable and helpful error on Python 2.4: + File "$HGTMP/install/lib/python/mercurial/changelog.py", line 175, in headrevs + return self.index.headrevs(self.filteredrevs) + ValueError: unable to check filter + [1] With TypeError the exception is lost and the code will continue but misbehave. In the tests it shows as test-glog.t failing in weird ways. Python 2.7.8 also seems to ignore TypeError here. This doesn't make sense and we should figure out what really is going on, but it helps pointing out why test-glog.t is failing on Python 2.4. No other tests are failing even though index.headrevs terminates with an error that is ignored. That suggests that we have insufficient test coverage of the headrevs code. diff --git a/mercurial/parsers.c b/mercurial/parsers.c --- a/mercurial/parsers.c +++ b/mercurial/parsers.c @@ -950,7 +950,7 @@ static PyObject *index_headrevs(indexObj isfiltered = check_filter(filter, i); if (isfiltered == -1) { - PyErr_SetString(PyExc_TypeError, + PyErr_SetString(PyExc_ValueError, "unable to check filter"); goto bail; }