Mercurial > hg-stable
changeset 30171:7a3b59f0329a
parsers: avoid PySliceObject cast on Python 3
PySlice_GetIndicesEx() accepts a PySliceObject* on Python 2 and a
PyObject* on Python 3. Casting to PySliceObject* on Python 3 was
yielding a compiler warning. So stop doing that.
With this patch, I no longer see any compiler warnings when
building the core extensions for Python 3!
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 13 Oct 2016 13:34:53 +0200 |
parents | 15635d8b17e0 |
children | 90a6c18a7c1d |
files | mercurial/parsers.c |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/parsers.c Thu Oct 13 13:27:14 2016 +0200 +++ b/mercurial/parsers.c Thu Oct 13 13:34:53 2016 +0200 @@ -2276,7 +2276,12 @@ Py_ssize_t length = index_length(self); int ret = 0; +/* Argument changed from PySliceObject* to PyObject* in Python 3. */ +#ifdef IS_PY3K + if (PySlice_GetIndicesEx(item, length, +#else if (PySlice_GetIndicesEx((PySliceObject*)item, length, +#endif &start, &stop, &step, &slicelength) < 0) return -1;