[Python-checkins] python/dist/src/Objects boolobject.c,1.5,1.6

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Sat, 19 Apr 2003 11:15:13 -0700


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

Modified Files:
	boolobject.c 
Log Message:
- bool() called without arguments now returns False rather than
  raising an exception.  This is consistent with calling the
  constructors for the other builtin types -- called without argument
  they all return the false value of that type.  (SF patch #724135)
  Thanks to Alex Martelli.


Index: boolobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/boolobject.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** boolobject.c	6 Aug 2002 22:12:52 -0000	1.5
--- boolobject.c	19 Apr 2003 18:15:10 -0000	1.6
***************
*** 52,59 ****
  {
  	static char *kwlist[] = {"x", 0};
! 	PyObject *x;
  	long ok;
  
! 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:bool", kwlist, &x))
  		return NULL;
  	ok = PyObject_IsTrue(x);
--- 52,59 ----
  {
  	static char *kwlist[] = {"x", 0};
! 	PyObject *x = Py_False;
  	long ok;
  
! 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:bool", kwlist, &x))
  		return NULL;
  	ok = PyObject_IsTrue(x);