[Python-checkins] python/dist/src/Objects object.c,2.191,2.192

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Fri, 23 Aug 2002 23:31:37 -0700


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

Modified Files:
	object.c 
Log Message:
Speedup for PyObject_IsTrue(): check for True and False first.
Because all built-in tests return bools now, this is the most common
path!


Index: object.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v
retrieving revision 2.191
retrieving revision 2.192
diff -C2 -d -r2.191 -r2.192
*** object.c	24 Aug 2002 05:33:28 -0000	2.191
--- object.c	24 Aug 2002 06:31:34 -0000	2.192
***************
*** 1498,1501 ****
--- 1498,1505 ----
  {
  	int res;
+ 	if (v == Py_True)
+ 		return 1;
+ 	if (v == Py_False)
+ 		return 0;
  	if (v == Py_None)
  		return 0;