summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-10-17 01:05:04 +0300
committerBerker Peksag <berker.peksag@gmail.com>2016-10-17 01:05:04 +0300
commit05b84439a3541ea3a2fdda9f8abfd46b64c431e8 (patch)
treee3c1054e86b2247190703d9273341048203ad16d /Python
parent197332ae5a9d4885806b5cceafef650c4e8f8b77 (diff)
downloadcpython-git-05b84439a3541ea3a2fdda9f8abfd46b64c431e8.tar.gz
Issue #21720: Improve exception message when the type of fromlist is unicode
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c
index af47b0bdb4..1d74faf5f6 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2591,8 +2591,9 @@ ensure_fromlist(PyObject *mod, PyObject *fromlist, char *buf, Py_ssize_t buflen,
return 0;
}
if (!PyString_Check(item)) {
- PyErr_SetString(PyExc_TypeError,
- "Item in ``from list'' not a string");
+ PyErr_Format(PyExc_TypeError,
+ "Item in ``from list'' must be str, not %.200s",
+ Py_TYPE(item)->tp_name);
Py_DECREF(item);
return 0;
}