mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Marc-Andre Lemburg <mal@lemburg.com>:
Better error message for "1 in unicodestring". Submitted by Andrew Kuchling.
This commit is contained in:
parent
e39607f27e
commit
7c014684c2
1 changed files with 4 additions and 1 deletions
|
|
@ -2988,8 +2988,11 @@ int PyUnicode_Contains(PyObject *container,
|
||||||
|
|
||||||
/* Coerce the two arguments */
|
/* Coerce the two arguments */
|
||||||
v = (PyUnicodeObject *)PyUnicode_FromObject(element);
|
v = (PyUnicodeObject *)PyUnicode_FromObject(element);
|
||||||
if (v == NULL)
|
if (v == NULL) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,
|
||||||
|
"'in <string>' requires character as left operand");
|
||||||
goto onError;
|
goto onError;
|
||||||
|
}
|
||||||
u = (PyUnicodeObject *)PyUnicode_FromObject(container);
|
u = (PyUnicodeObject *)PyUnicode_FromObject(container);
|
||||||
if (u == NULL) {
|
if (u == NULL) {
|
||||||
Py_DECREF(v);
|
Py_DECREF(v);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue