[Python-checkins] python/dist/src/Objects typeobject.c,2.247,2.248

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Sat Oct 11 15:32:20 EDT 2003


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv25355

Modified Files:
	typeobject.c 
Log Message:
Use the simpler and faster PyArg_UnpackTuple() instead of 
PyArg_ParseTuple() where possible.



Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.247
retrieving revision 2.248
diff -C2 -d -r2.247 -r2.248
*** typeobject.c	11 Oct 2003 17:29:04 -0000	2.247
--- typeobject.c	11 Oct 2003 19:32:18 -0000	2.248
***************
*** 3318,3322 ****
  	int res;
  
! 	if (!PyArg_ParseTuple(args, ""))
  		return NULL;
  	res = (*func)(self);
--- 3318,3322 ----
  	int res;
  
! 	if (!PyArg_UnpackTuple(args, "", 0, 0))
  		return NULL;
  	res = (*func)(self);
***************
*** 3332,3336 ****
  	int res;
  
! 	if (!PyArg_ParseTuple(args, ""))
  		return NULL;
  	res = (*func)(self);
--- 3332,3336 ----
  	int res;
  
! 	if (!PyArg_UnpackTuple(args, "", 0, 0))
  		return NULL;
  	res = (*func)(self);
***************
*** 3346,3350 ****
  	PyObject *other;
  
! 	if (!PyArg_ParseTuple(args, "O", &other))
  		return NULL;
  	return (*func)(self, other);
--- 3346,3350 ----
  	PyObject *other;
  
! 	if (!PyArg_UnpackTuple(args, "", 1, 1, &other))
  		return NULL;
  	return (*func)(self, other);
***************
*** 3357,3361 ****
  	PyObject *other;
  
! 	if (!PyArg_ParseTuple(args, "O", &other))
  		return NULL;
  	if (!(self->ob_type->tp_flags & Py_TPFLAGS_CHECKTYPES) &&
--- 3357,3361 ----
  	PyObject *other;
  
! 	if (!PyArg_UnpackTuple(args, "", 1, 1, &other))
  		return NULL;
  	if (!(self->ob_type->tp_flags & Py_TPFLAGS_CHECKTYPES) &&
***************
*** 3373,3377 ****
  	PyObject *other;
  
! 	if (!PyArg_ParseTuple(args, "O", &other))
  		return NULL;
  	if (!(self->ob_type->tp_flags & Py_TPFLAGS_CHECKTYPES) &&
--- 3373,3377 ----
  	PyObject *other;
  
! 	if (!PyArg_UnpackTuple(args, "", 1, 1, &other))
  		return NULL;
  	if (!(self->ob_type->tp_flags & Py_TPFLAGS_CHECKTYPES) &&
***************
*** 3390,3394 ****
  	int ok;
  
! 	if (!PyArg_ParseTuple(args, "O", &other))
  		return NULL;
  	ok = func(&self, &other);
--- 3390,3394 ----
  	int ok;
  
! 	if (!PyArg_UnpackTuple(args, "", 1, 1, &other))
  		return NULL;
  	ok = func(&self, &other);
***************
*** 3419,3423 ****
  	/* Note: This wrapper only works for __pow__() */
  
! 	if (!PyArg_ParseTuple(args, "O|O", &other, &third))
  		return NULL;
  	return (*func)(self, other, third);
--- 3419,3423 ----
  	/* Note: This wrapper only works for __pow__() */
  
! 	if (!PyArg_UnpackTuple(args, "", 1, 2, &other, &third))
  		return NULL;
  	return (*func)(self, other, third);
***************
*** 3433,3437 ****
  	/* Note: This wrapper only works for __pow__() */
  
! 	if (!PyArg_ParseTuple(args, "O|O", &other, &third))
  		return NULL;
  	return (*func)(other, self, third);
--- 3433,3437 ----
  	/* Note: This wrapper only works for __pow__() */
  
! 	if (!PyArg_UnpackTuple(args, "", 1, 2, &other, &third))
  		return NULL;
  	return (*func)(other, self, third);
***************
*** 3443,3447 ****
  	unaryfunc func = (unaryfunc)wrapped;
  
! 	if (!PyArg_ParseTuple(args, ""))
  		return NULL;
  	return (*func)(self);
--- 3443,3447 ----
  	unaryfunc func = (unaryfunc)wrapped;
  
! 	if (!PyArg_UnpackTuple(args, "", 0, 0))
  		return NULL;
  	return (*func)(self);
***************
*** 3493,3497 ****
  		return (*func)(self, i);
  	}
! 	PyArg_ParseTuple(args, "O", &arg);
  	assert(PyErr_Occurred());
  	return NULL;
--- 3493,3497 ----
  		return (*func)(self, i);
  	}
! 	PyArg_UnpackTuple(args, "", 1, 1, &arg);
  	assert(PyErr_Occurred());
  	return NULL;
***************
*** 3516,3520 ****
  	PyObject *arg, *value;
  
! 	if (!PyArg_ParseTuple(args, "OO", &arg, &value))
  		return NULL;
  	i = getindex(self, arg);
--- 3516,3520 ----
  	PyObject *arg, *value;
  
! 	if (!PyArg_UnpackTuple(args, "", 2, 2, &arg, &value))
  		return NULL;
  	i = getindex(self, arg);
***************
*** 3535,3539 ****
  	PyObject *arg;
  
! 	if (!PyArg_ParseTuple(args, "O", &arg))
  		return NULL;
  	i = getindex(self, arg);
--- 3535,3539 ----
  	PyObject *arg;
  
! 	if (!PyArg_UnpackTuple(args, "", 1, 1, &arg))
  		return NULL;
  	i = getindex(self, arg);
***************
*** 3586,3590 ****
  	PyObject *value;
  
! 	if (!PyArg_ParseTuple(args, "O", &value))
  		return NULL;
  	res = (*func)(self, value);
--- 3586,3590 ----
  	PyObject *value;
  
! 	if (!PyArg_UnpackTuple(args, "", 1, 1, &value))
  		return NULL;
  	res = (*func)(self, value);
***************
*** 3602,3606 ****
  	PyObject *key, *value;
  
! 	if (!PyArg_ParseTuple(args, "OO", &key, &value))
  		return NULL;
  	res = (*func)(self, key, value);
--- 3602,3606 ----
  	PyObject *key, *value;
  
! 	if (!PyArg_UnpackTuple(args, "", 2, 2, &key, &value))
  		return NULL;
  	res = (*func)(self, key, value);
***************
*** 3618,3622 ****
  	PyObject *key;
  
! 	if (!PyArg_ParseTuple(args, "O", &key))
  		return NULL;
  	res = (*func)(self, key, NULL);
--- 3618,3622 ----
  	PyObject *key;
  
! 	if (!PyArg_UnpackTuple(args, "", 1, 1, &key))
  		return NULL;
  	res = (*func)(self, key, NULL);
***************
*** 3634,3638 ****
  	PyObject *other;
  
! 	if (!PyArg_ParseTuple(args, "O", &other))
  		return NULL;
  	if (other->ob_type->tp_compare != func &&
--- 3634,3638 ----
  	PyObject *other;
  
! 	if (!PyArg_UnpackTuple(args, "", 1, 1, &other))
  		return NULL;
  	if (other->ob_type->tp_compare != func &&
***************
*** 3677,3681 ****
  	PyObject *name, *value;
  
! 	if (!PyArg_ParseTuple(args, "OO", &name, &value))
  		return NULL;
  	if (!hackcheck(self, func, "__setattr__"))
--- 3677,3681 ----
  	PyObject *name, *value;
  
! 	if (!PyArg_UnpackTuple(args, "", 2, 2, &name, &value))
  		return NULL;
  	if (!hackcheck(self, func, "__setattr__"))
***************
*** 3695,3699 ****
  	PyObject *name;
  
! 	if (!PyArg_ParseTuple(args, "O", &name))
  		return NULL;
  	if (!hackcheck(self, func, "__delattr__"))
--- 3695,3699 ----
  	PyObject *name;
  
! 	if (!PyArg_UnpackTuple(args, "", 1, 1, &name))
  		return NULL;
  	if (!hackcheck(self, func, "__delattr__"))
***************
*** 3712,3716 ****
  	long res;
  
! 	if (!PyArg_ParseTuple(args, ""))
  		return NULL;
  	res = (*func)(self);
--- 3712,3716 ----
  	long res;
  
! 	if (!PyArg_UnpackTuple(args, "", 0, 0))
  		return NULL;
  	res = (*func)(self);
***************
*** 3734,3738 ****
  	PyObject *other;
  
! 	if (!PyArg_ParseTuple(args, "O", &other))
  		return NULL;
  	return (*func)(self, other, op);
--- 3734,3738 ----
  	PyObject *other;
  
! 	if (!PyArg_UnpackTuple(args, "", 1, 1, &other))
  		return NULL;
  	return (*func)(self, other, op);
***************
*** 3760,3764 ****
  	PyObject *res;
  
! 	if (!PyArg_ParseTuple(args, ""))
  		return NULL;
  	res = (*func)(self);
--- 3760,3764 ----
  	PyObject *res;
  
! 	if (!PyArg_UnpackTuple(args, "", 0, 0))
  		return NULL;
  	res = (*func)(self);
***************
*** 3775,3779 ****
  	PyObject *type = NULL;
  
! 	if (!PyArg_ParseTuple(args, "O|O", &obj, &type))
  		return NULL;
  	if (obj == Py_None)
--- 3775,3779 ----
  	PyObject *type = NULL;
  
! 	if (!PyArg_UnpackTuple(args, "", 1, 2, &obj, &type))
  		return NULL;
  	if (obj == Py_None)
***************
*** 3796,3800 ****
  	int ret;
  
! 	if (!PyArg_ParseTuple(args, "OO", &obj, &value))
  		return NULL;
  	ret = (*func)(self, obj, value);
--- 3796,3800 ----
  	int ret;
  
! 	if (!PyArg_UnpackTuple(args, "", 2, 2, &obj, &value))
  		return NULL;
  	ret = (*func)(self, obj, value);
***************
*** 3812,3816 ****
  	int ret;
  
! 	if (!PyArg_ParseTuple(args, "O", &obj))
  		return NULL;
  	ret = (*func)(self, obj, NULL);
--- 3812,3816 ----
  	int ret;
  
! 	if (!PyArg_UnpackTuple(args, "", 1, 1, &obj))
  		return NULL;
  	ret = (*func)(self, obj, NULL);





More information about the Python-checkins mailing list