Mercurial > public > mercurial-scm > hg
diff mercurial/cext/revlog.c @ 38852:a3dacabd476b
index: don't allow index[len(index)] to mean nullid
Now everything else has been cleaned up and we can drop support for
getting the nullid from the end of the index (from *past* the end
actually, since we reduced the length in the previous patch).
Differential Revision: https://phab.mercurial-scm.org/D4023
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 20 Jul 2018 14:36:42 -0700 |
parents | 781b2720d2ac |
children | aa33988ad8ab |
line wrap: on
line diff
--- a/mercurial/cext/revlog.c Fri Jul 20 08:10:32 2018 -0700 +++ b/mercurial/cext/revlog.c Fri Jul 20 14:36:42 2018 -0700 @@ -158,12 +158,12 @@ Py_ssize_t length = index_length(self) + 1; PyObject *entry; - if (pos == -1 || pos == length - 1) { + if (pos == -1) { Py_INCREF(nullentry); return nullentry; } - if (pos < 0 || pos >= length) { + if (pos < 0 || pos >= length - 1) { PyErr_SetString(PyExc_IndexError, "revlog index out of range"); return NULL; }