comparison src/if_python3.c @ 4389:736b8e18a3bc v7.3.943

updated for version 7.3.943 Problem: Python: Negative indices were failing. Solution: Fix negative indices. Add tests. (ZyX)
author Bram Moolenaar <bram@vim.org>
date Sun, 12 May 2013 21:16:23 +0200
parents 358c10968c7f
children 80eea7a9d6b9
comparison
equal deleted inserted replaced
4388:a38216d77e73 4389:736b8e18a3bc
1112 1112
1113 if (CheckBuffer((BufferObject *) self)) 1113 if (CheckBuffer((BufferObject *) self))
1114 return NULL; 1114 return NULL;
1115 1115
1116 if (PySlice_GetIndicesEx((PyObject *)idx, 1116 if (PySlice_GetIndicesEx((PyObject *)idx,
1117 (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count+1, 1117 (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count,
1118 &start, &stop, 1118 &start, &stop,
1119 &step, &slicelen) < 0) 1119 &step, &slicelen) < 0)
1120 { 1120 {
1121 return NULL; 1121 return NULL;
1122 } 1122 }
1144 1144
1145 if (CheckBuffer((BufferObject *) self)) 1145 if (CheckBuffer((BufferObject *) self))
1146 return -1; 1146 return -1;
1147 1147
1148 if (PySlice_GetIndicesEx((PyObject *)idx, 1148 if (PySlice_GetIndicesEx((PyObject *)idx,
1149 (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count+1, 1149 (Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count,
1150 &start, &stop, 1150 &start, &stop,
1151 &step, &slicelen) < 0) 1151 &step, &slicelen) < 0)
1152 { 1152 {
1153 return -1; 1153 return -1;
1154 } 1154 }