diff options
author | Georg Brandl <georg@python.org> | 2007-03-06 19:00:09 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-03-06 19:00:09 (GMT) |
commit | 62b1b001e6798ed178e1c65d26d4e031ca00ff39 (patch) | |
tree | fcf9a4ccc2b90632883b62f04f60bb58003e4585 /Modules | |
parent | 2230d98048be1a20bd177ea72b2124941cd1d9ea (diff) | |
download | cpython-62b1b001e6798ed178e1c65d26d4e031ca00ff39.zip cpython-62b1b001e6798ed178e1c65d26d4e031ca00ff39.tar.gz cpython-62b1b001e6798ed178e1c65d26d4e031ca00ff39.tar.bz2 |
Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
(backport from rev. 54177)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/operator.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/Modules/operator.c b/Modules/operator.c index 7479a53..0a7222a 100644 --- a/Modules/operator.c +++ b/Modules/operator.c @@ -168,43 +168,41 @@ static PyObject* op_getslice(PyObject *s, PyObject *a) { PyObject *a1; - int a2,a3; + Py_ssize_t a2, a3; - if (!PyArg_ParseTuple(a,"Oii:getslice",&a1,&a2,&a3)) + if (!PyArg_ParseTuple(a, "Onn:getslice", &a1, &a2, &a3)) return NULL; - return PySequence_GetSlice(a1,a2,a3); + return PySequence_GetSlice(a1, a2, a3); } static PyObject* op_setslice(PyObject *s, PyObject *a) { PyObject *a1, *a4; - int a2,a3; + Py_ssize_t a2, a3; - if (!PyArg_ParseTuple(a,"OiiO:setslice",&a1,&a2,&a3,&a4)) + if (!PyArg_ParseTuple(a, "OnnO:setslice", &a1, &a2, &a3, &a4)) return NULL; - if (-1 == PySequence_SetSlice(a1,a2,a3,a4)) + if (-1 == PySequence_SetSlice(a1, a2, a3, a4)) return NULL; - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } static PyObject* op_delslice(PyObject *s, PyObject *a) { PyObject *a1; - int a2,a3; + Py_ssize_t a2, a3; - if(! PyArg_ParseTuple(a,"Oii:delslice",&a1,&a2,&a3)) + if (!PyArg_ParseTuple(a, "Onn:delslice", &a1, &a2, &a3)) return NULL; - if (-1 == PySequence_DelSlice(a1,a2,a3)) + if (-1 == PySequence_DelSlice(a1, a2, a3)) return NULL; - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } #undef spam1 |