diff Python/ceval.c @ 84583:c3f9292c8efe

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.
author Brett Cannon <brett@python.org>
date Fri, 12 Jul 2013 11:22:26 -0400
parents d9446c2a2fd4
children 71a572a516f9
line wrap: on
line diff
--- a/Python/ceval.c	Fri Jul 12 11:04:23 2013 -0400
+++ b/Python/ceval.c	Fri Jul 12 11:22:26 2013 -0400
@@ -4602,7 +4602,7 @@
 
     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;
 }