comparison mercurial/parsers.c @ 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 5f7151e6de85
children 6146d5acee69
comparison
equal deleted inserted replaced
30170:15635d8b17e0 30171:7a3b59f0329a
2274 { 2274 {
2275 Py_ssize_t start, stop, step, slicelength; 2275 Py_ssize_t start, stop, step, slicelength;
2276 Py_ssize_t length = index_length(self); 2276 Py_ssize_t length = index_length(self);
2277 int ret = 0; 2277 int ret = 0;
2278 2278
2279 /* Argument changed from PySliceObject* to PyObject* in Python 3. */
2280 #ifdef IS_PY3K
2281 if (PySlice_GetIndicesEx(item, length,
2282 #else
2279 if (PySlice_GetIndicesEx((PySliceObject*)item, length, 2283 if (PySlice_GetIndicesEx((PySliceObject*)item, length,
2284 #endif
2280 &start, &stop, &step, &slicelength) < 0) 2285 &start, &stop, &step, &slicelength) < 0)
2281 return -1; 2286 return -1;
2282 2287
2283 if (slicelength <= 0) 2288 if (slicelength <= 0)
2284 return 0; 2289 return 0;