Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb95a14

Browse files
committed
Patch from Michael Hudson: improve unclear error message
1 parent b422f95 commit cb95a14

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Objects/stringobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ PyObject *a, *el;
393393
return PyUnicode_Contains(a, el);
394394
if (!PyString_Check(el) || PyString_Size(el) != 1) {
395395
PyErr_SetString(PyExc_TypeError,
396-
"string member test needs char left operand");
396+
"'in <string>' requires character as left operand");
397397
return -1;
398398
}
399399
c = PyString_AsString(el)[0];

Objects/unicodeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2996,7 +2996,7 @@ int PyUnicode_Contains(PyObject *container,
29962996
/* Check v in u */
29972997
if (PyUnicode_GET_SIZE(v) != 1) {
29982998
PyErr_SetString(PyExc_TypeError,
2999-
"string member test needs char left operand");
2999+
"'in <string>' requires character as left operand");
30003000
goto onError;
30013001
}
30023002
ch = *PyUnicode_AS_UNICODE(v);

0 commit comments

Comments
 (0)