[Python-checkins] CVS: python/dist/src/Objects abstract.c,2.31,2.32
Guido van Rossum
guido@cnri.reston.va.us
Tue, 7 Mar 2000 10:54:47 -0500 (EST)
Update of /projects/cvsroot/python/dist/src/Objects
In directory eric:/projects/python/develop/guido/src/Objects
Modified Files:
abstract.c
Log Message:
Patch by Moshe Zadka: remove the string special case in
PySequence_Contains() now that string objects have this code in their
tp_contains.
Index: abstract.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Objects/abstract.c,v
retrieving revision 2.31
retrieving revision 2.32
diff -C2 -r2.31 -r2.32
*** abstract.c 2000/02/28 15:01:46 2.31
--- abstract.c 2000/03/07 15:54:45 2.32
***************
*** 1122,1143 ****
PySequenceMethods *sq;
- /* Special case for char in string */
- if (PyString_Check(w)) {
- register char *s, *end;
- register char c;
- if (!PyString_Check(v) || PyString_Size(v) != 1) {
- PyErr_SetString(PyExc_TypeError,
- "string member test needs char left operand");
- return -1;
- }
- c = PyString_AsString(v)[0];
- s = PyString_AsString(w);
- end = s + PyString_Size(w);
- while (s < end) {
- if (c == *s++)
- return 1;
- }
- return 0;
- }
if(PyType_HasFeature(w->ob_type, Py_TPFLAGS_HAVE_SEQUENCE_IN)) {
sq = w->ob_type->tp_as_sequence;
--- 1122,1125 ----