diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-12 17:03:09 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-12 17:03:09 (GMT) |
commit | 8a87f5d37e6aab91ddc4c6491877b6cbd48a12cf (patch) | |
tree | 330bb4b553958f129b31e31ccea2a2c835b19de0 /Modules/operator.c | |
parent | f3e304297e94b9b1956a4ed95debd1b163958d71 (diff) | |
download | cpython-8a87f5d37e6aab91ddc4c6491877b6cbd48a12cf.zip cpython-8a87f5d37e6aab91ddc4c6491877b6cbd48a12cf.tar.gz cpython-8a87f5d37e6aab91ddc4c6491877b6cbd48a12cf.tar.bz2 |
Patch #1538606, Patch to fix __index__() clipping.
I modified this patch some by fixing style, some error checking, and adding
XXX comments. This patch requires review and some changes are to be expected.
I'm checking in now to get the greatest possible review and establish a
baseline for moving forward. I don't want this to hold up release if possible.
Diffstat (limited to 'Modules/operator.c')
-rw-r--r-- | Modules/operator.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/Modules/operator.c b/Modules/operator.c index 7fc1f8a..7479a53 100644 --- a/Modules/operator.c +++ b/Modules/operator.c @@ -139,15 +139,7 @@ op_ipow(PyObject *s, PyObject *a) static PyObject * op_index(PyObject *s, PyObject *a) { - Py_ssize_t i; - PyObject *a1; - if (!PyArg_UnpackTuple(a,"index", 1, 1, &a1)) - return NULL; - i = PyNumber_Index(a1); - if (i == -1 && PyErr_Occurred()) - return NULL; - else - return PyInt_FromSsize_t(i); + return PyNumber_Index(a); } static PyObject* @@ -249,7 +241,7 @@ spam1o(isMappingType, spam1(is_, "is_(a, b) -- Same as a is b.") spam1(is_not, "is_not(a, b) -- Same as a is not b.") -spam2(index, __index__, "index(a) -- Same as a.__index__()") +spam2o(index, __index__, "index(a) -- Same as a.__index__()") spam2(add,__add__, "add(a, b) -- Same as a + b.") spam2(sub,__sub__, "sub(a, b) -- Same as a - b.") spam2(mul,__mul__, "mul(a, b) -- Same as a * b.") |