summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-03-13 15:56:08 (GMT)
committerGuido van Rossum <guido@python.org>2000-03-13 15:56:08 (GMT)
commit96a45adf808ee9798d0c2637aeed2c895fa8e929 (patch)
tree48cb2561b3aa90702b5cba7e7605fba17925cb29
parent403d68b484a263cce1a34642a4e6865a599ddfad (diff)
downloadcpython-96a45adf808ee9798d0c2637aeed2c895fa8e929.zip
cpython-96a45adf808ee9798d0c2637aeed2c895fa8e929.tar.gz
cpython-96a45adf808ee9798d0c2637aeed2c895fa8e929.tar.bz2
Fix typo in replace() detected by Mark Hammond and fixed by Marc-Andre.
-rw-r--r--Objects/stringobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index c83983f..2d404b9 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -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;
}