]> granicus.if.org Git - python/commitdiff
Patch by Moshe Zadka: remove the string special case in
authorGuido van Rossum <guido@python.org>
Tue, 7 Mar 2000 15:54:45 +0000 (15:54 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 7 Mar 2000 15:54:45 +0000 (15:54 +0000)
PySequence_Contains() now that string objects have this code in their
tp_contains.

Objects/abstract.c

index 739d9d9d55ec5e0d58314e1c3ea9ddb8052de2cb..970d80fa2fe40c60a2ed22ef687892373f728cff 100644 (file)
@@ -1121,24 +1121,6 @@ PySequence_Contains(w, v) /* v in w */
        PyObject *x;
        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;
                if(sq != NULL && sq->sq_contains != NULL)