@@ -12,12 +12,12 @@ used for special class methods; variants without leading and trailing\n\
1212
1313#define spam1 (OP ,AOP ) static PyObject *OP(PyObject *s, PyObject *a) { \
1414 PyObject *a1; \
15- if(! PyArg_ParseTuple (a,"O:" #OP,&a1)) return NULL; \
15+ if(! PyArg_UnpackTuple (a,#OP,1,1 ,&a1)) return NULL; \
1616 return AOP(a1); }
1717
1818#define spam2 (OP ,AOP ) static PyObject *OP(PyObject *s, PyObject *a) { \
1919 PyObject *a1, *a2; \
20- if(! PyArg_ParseTuple (a,"OO:" #OP,&a1,&a2)) return NULL; \
20+ if(! PyArg_UnpackTuple (a,#OP,2,2 ,&a1,&a2)) return NULL; \
2121 return AOP(a1,a2); }
2222
2323#define spamoi (OP ,AOP ) static PyObject *OP(PyObject *s, PyObject *a) { \
@@ -27,39 +27,39 @@ used for special class methods; variants without leading and trailing\n\
2727
2828#define spam2n (OP ,AOP ) static PyObject *OP(PyObject *s, PyObject *a) { \
2929 PyObject *a1, *a2; \
30- if(! PyArg_ParseTuple (a,"OO:" #OP,&a1,&a2)) return NULL; \
30+ if(! PyArg_UnpackTuple (a,#OP,2,2 ,&a1,&a2)) return NULL; \
3131 if(-1 == AOP(a1,a2)) return NULL; \
3232 Py_INCREF(Py_None); \
3333 return Py_None; }
3434
3535#define spam3n (OP ,AOP ) static PyObject *OP(PyObject *s, PyObject *a) { \
3636 PyObject *a1, *a2, *a3; \
37- if(! PyArg_ParseTuple (a,"OOO:" #OP,&a1,&a2,&a3)) return NULL; \
37+ if(! PyArg_UnpackTuple (a,#OP,3,3 ,&a1,&a2,&a3)) return NULL; \
3838 if(-1 == AOP(a1,a2,a3)) return NULL; \
3939 Py_INCREF(Py_None); \
4040 return Py_None; }
4141
4242#define spami (OP ,AOP ) static PyObject *OP(PyObject *s, PyObject *a) { \
4343 PyObject *a1; long r; \
44- if(! PyArg_ParseTuple (a,"O:" #OP,&a1)) return NULL; \
44+ if(! PyArg_UnpackTuple (a,#OP,1,1 ,&a1)) return NULL; \
4545 if(-1 == (r=AOP(a1))) return NULL; \
4646 return PyBool_FromLong(r); }
4747
4848#define spami2 (OP ,AOP ) static PyObject *OP(PyObject *s, PyObject *a) { \
4949 PyObject *a1, *a2; long r; \
50- if(! PyArg_ParseTuple (a,"OO:" #OP,&a1,&a2)) return NULL; \
50+ if(! PyArg_UnpackTuple (a,#OP,2,2 ,&a1,&a2)) return NULL; \
5151 if(-1 == (r=AOP(a1,a2))) return NULL; \
5252 return PyInt_FromLong(r); }
5353
5454#define spami2b (OP ,AOP ) static PyObject *OP(PyObject *s, PyObject *a) { \
5555 PyObject *a1, *a2; long r; \
56- if(! PyArg_ParseTuple (a,"OO:" #OP,&a1,&a2)) return NULL; \
56+ if(! PyArg_UnpackTuple (a,#OP,2,2 ,&a1,&a2)) return NULL; \
5757 if(-1 == (r=AOP(a1,a2))) return NULL; \
5858 return PyBool_FromLong(r); }
5959
6060#define spamrc (OP ,A ) static PyObject *OP(PyObject *s, PyObject *a) { \
6161 PyObject *a1, *a2; \
62- if(! PyArg_ParseTuple (a,"OO:" #OP,&a1,&a2)) return NULL; \
62+ if(! PyArg_UnpackTuple (a,#OP,2,2 ,&a1,&a2)) return NULL; \
6363 return PyObject_RichCompare(a1,a2,A); }
6464
6565spami (isCallable , PyCallable_Check )
@@ -105,7 +105,7 @@ static PyObject*
105105op_pow (PyObject * s , PyObject * a )
106106{
107107 PyObject * a1 , * a2 ;
108- if (PyArg_ParseTuple (a ,"OO: pow" ,& a1 ,& a2 ))
108+ if (PyArg_UnpackTuple (a ,"pow" , 2 , 2 , & a1 , & a2 ))
109109 return PyNumber_Power (a1 , a2 , Py_None );
110110 return NULL ;
111111}
0 commit comments