mirror of
https://github.com/python/cpython.git
synced 2025-07-12 22:05:16 +00:00
Issue #18342: Use the repr of a module name for ``from ... import
...`` when an ImportError occurs. Other cases had already been switched over to using the repr. Thanks to Tomasz Maćkowiak for the patch.
This commit is contained in:
parent
f0cb69274c
commit
a79e4fb38d
4 changed files with 13 additions and 1 deletions
|
@ -4602,7 +4602,7 @@ import_from(PyObject *v, PyObject *name)
|
|||
|
||||
x = PyObject_GetAttr(v, name);
|
||||
if (x == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) {
|
||||
PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
|
||||
PyErr_Format(PyExc_ImportError, "cannot import name %R", name);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue