diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-04-22 11:15:41 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-04-22 11:15:41 (GMT) |
commit | 26fd9607c729f4dbe322967464834a2bce18c07d (patch) | |
tree | dbe8e2a9ce2960e77a99a8df198795b82ad38555 /Modules/operator.c | |
parent | 8694a6db0e590887c5e43eb949481935f89de424 (diff) | |
download | cpython-26fd9607c729f4dbe322967464834a2bce18c07d.zip cpython-26fd9607c729f4dbe322967464834a2bce18c07d.tar.gz cpython-26fd9607c729f4dbe322967464834a2bce18c07d.tar.bz2 |
Fix more ssize_t problems.
Diffstat (limited to 'Modules/operator.c')
-rw-r--r-- | Modules/operator.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/operator.c b/Modules/operator.c index 25b3999..7fc1f8a 100644 --- a/Modules/operator.c +++ b/Modules/operator.c @@ -48,6 +48,12 @@ used for special class methods; variants without leading and trailing\n\ if(-1 == (r=AOP(a1,a2))) return NULL; \ return PyInt_FromLong(r); } +#define spamn2(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ + PyObject *a1, *a2; Py_ssize_t r; \ + if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \ + if(-1 == (r=AOP(a1,a2))) return NULL; \ + return PyInt_FromSsize_t(r); } + #define spami2b(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ PyObject *a1, *a2; long r; \ if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \ @@ -99,8 +105,8 @@ spam2(op_iconcat , PySequence_InPlaceConcat) spamoi(op_irepeat , PySequence_InPlaceRepeat) spami2b(op_contains , PySequence_Contains) spami2b(sequenceIncludes, PySequence_Contains) -spami2(indexOf , PySequence_Index) -spami2(countOf , PySequence_Count) +spamn2(indexOf , PySequence_Index) +spamn2(countOf , PySequence_Count) spami(isMappingType , PyMapping_Check) spam2(op_getitem , PyObject_GetItem) spam2n(op_delitem , PyObject_DelItem) |