[Python-checkins] python/dist/src/Objects descrobject.c, 2.35.10.1, 2.35.10.2 typeobject.c, 2.241.6.1, 2.241.6.2

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Thu Oct 9 16:51:09 EDT 2003


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

Modified Files:
      Tag: release23-maint
	descrobject.c typeobject.c 
Log Message:
SF patch #820195: make object.__contains__() returns True or False instead 
   of 1 or 0.

Backport Guido's fix to the default __contains__() and to proxy_has_key()
so they will properly return booleans instead of integers.



Index: descrobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v
retrieving revision 2.35.10.1
retrieving revision 2.35.10.2
diff -C2 -d -r2.35.10.1 -r2.35.10.2
*** descrobject.c	1 Sep 2003 22:14:42 -0000	2.35.10.1
--- descrobject.c	9 Oct 2003 20:51:07 -0000	2.35.10.2
***************
*** 710,714 ****
  proxy_has_key(proxyobject *pp, PyObject *key)
  {
! 	return PyInt_FromLong(PySequence_Contains(pp->dict, key));
  }
  
--- 710,717 ----
  proxy_has_key(proxyobject *pp, PyObject *key)
  {
! 	int res = PySequence_Contains(pp->dict, key);
! 	if (res < 0)
! 		return NULL;
! 	return PyBool_FromLong(res);
  }
  

Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.241.6.1
retrieving revision 2.241.6.2
diff -C2 -d -r2.241.6.1 -r2.241.6.2
*** typeobject.c	7 Aug 2003 15:08:55 -0000	2.241.6.1
--- typeobject.c	9 Oct 2003 20:51:07 -0000	2.241.6.2
***************
*** 3563,3567 ****
  	if (res == -1 && PyErr_Occurred())
  		return NULL;
! 	return PyInt_FromLong((long)res);
  }
  
--- 3563,3568 ----
  	if (res == -1 && PyErr_Occurred())
  		return NULL;
! 	else
! 		return PyBool_FromLong(res);
  }
  





More information about the Python-checkins mailing list