File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -321,6 +321,14 @@ def test_delete_builtins_import(self):
321321 stdout , stderr = popen .communicate ()
322322 self .assertIn (b"ImportError" , stdout )
323323
324+ def test_from_import_message_for_nonexistent_module (self ):
325+ with self .assertRaisesRegexp (ImportError , "^No module named 'bogus'" ):
326+ from bogus import foo
327+
328+ def test_from_import_message_for_existing_module (self ):
329+ with self .assertRaisesRegexp (ImportError , "^cannot import name 'bogus'" ):
330+ from re import bogus
331+
324332
325333@skip_if_dont_write_bytecode
326334class FilePermissionTests (unittest .TestCase ):
Original file line number Diff line number Diff line change @@ -786,6 +786,7 @@ Andrew I MacIntyre
786786Tim MacKenzie
787787Nick Maclaren
788788Don MacMillen
789+ Tomasz Maćkowiak
789790Steve Majewski
790791Grzegorz Makarewicz
791792David Malcolm
Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ What's New in Python 3.4.0 Alpha 1?
1010Core and Builtins
1111-----------------
1212
13+ - Issue #18342: Use the repr of a module name when an import fails when using
14+ ``from ... import ...``.
15+
1316- Issue #17872: Fix a segfault in marshal.load() when input stream returns
1417 more bytes than requested.
1518
Original file line number Diff line number Diff line change @@ -4602,7 +4602,7 @@ import_from(PyObject *v, PyObject *name)
46024602
46034603 x = PyObject_GetAttr (v , name );
46044604 if (x == NULL && PyErr_ExceptionMatches (PyExc_AttributeError )) {
4605- PyErr_Format (PyExc_ImportError , "cannot import name %S " , name );
4605+ PyErr_Format (PyExc_ImportError , "cannot import name %R " , name );
46064606 }
46074607 return x ;
46084608}
You can’t perform that action at this time.
0 commit comments