]> granicus.if.org Git - python/commitdiff
Fix typo in replace() detected by Mark Hammond and fixed by Marc-Andre.
authorGuido van Rossum <guido@python.org>
Mon, 13 Mar 2000 15:56:08 +0000 (15:56 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 13 Mar 2000 15:56:08 +0000 (15:56 +0000)
Objects/stringobject.c

index c83983fee8df47d75c7404b5d0ac4cd6b12a368b..2d404b92bb97f8823a19ec70e246ddf3e4a47b08 100644 (file)
@@ -389,7 +389,9 @@ PyObject *a, *el;
 {
        register char *s, *end;
        register char c;
-       if (!PyString_Check(el) || PyString_Size(el) != 1) {
+       if (!PyString_Check(el))
+               return PyUnicode_Contains(a, el);
+       if (PyString_Size(el) != 1) {
                PyErr_SetString(PyExc_TypeError,
                                "string member test needs char left operand");
                return -1;
@@ -1575,7 +1577,7 @@ string_replace(self, args)
        else if (PyObject_AsCharBuffer(replobj, &repl, &repl_len))
                return NULL;
 
-       if (repl_len <= 0) {
+       if (sub_len <= 0) {
                PyErr_SetString(PyExc_ValueError, "empty replacement string");
                return NULL;
        }