[Python-checkins] CVS: python/dist/src/Include abstract.h,2.33,2.34
Tim Peters
tim_one@users.sourceforge.net
Sat, 05 May 2001 14:05:03 -0700
Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv30187/python/dist/src/Include
Modified Files:
abstract.h
Log Message:
Reimplement PySequence_Contains() and instance_contains(), so they work
safely together and don't duplicate logic (the common logic was factored
out into new private API function _PySequence_IterContains()).
Visible change:
some_complex_number in some_instance
no longer blows up if some_instance has __getitem__ but neither
__contains__ nor __iter__. test_iter changed to ensure that remains true.
Index: abstract.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v
retrieving revision 2.33
retrieving revision 2.34
diff -C2 -r2.33 -r2.34
*** abstract.h 2001/05/05 03:56:37 2.33
--- abstract.h 2001/05/05 21:05:01 2.34
***************
*** 933,937 ****
*/
! DL_IMPORT(int) PySequence_Contains(PyObject *o, PyObject *value);
/* For DLL-level backwards compatibility */
--- 933,947 ----
*/
! DL_IMPORT(int) PySequence_Contains(PyObject *seq, PyObject *ob);
! /*
! Return -1 if error; 1 if ob in seq; 0 if ob not in seq.
! Use __contains__ if possible, else _PySequence_IterContains().
! */
!
! DL_IMPORT(int) _PySequence_IterContains(PyObject *seq, PyObject *ob);
! /*
! Return -1 if error; 1 if ob in seq; 0 if ob not in seq.
! Always uses the iteration protocol, and only Py_EQ comparisons.
! */
/* For DLL-level backwards compatibility */