Author mbussonn
Recipients barry, brett.cannon, mbussonn
Date 2017-02-15.00:51:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487119901.86.0.718504995242.issue29546@psf.upfronthosting.co.za>
In-reply-to
Content
I'm unsure I understand changing only the default __str__() method. You will anyway have to format the message differently depending on whether you raise from a from-import or a from-import-* or any other locations. 

AFAIU you "just" need the following 

  -        PyErr_SetImportError(PyUnicode_FromFormat("cannot import name %R", name), pkgname, pkgpath);
  +        PyErr_SetImportError(
  +                PyUnicode_FromFormat("cannot import name %R from %R (%S)",
  +                    name, pkgname, pkgpath),
  +                pkgname, pkgpath);

To use Barry format (though keeping quotes around identifiers to match current behavior).
(And similar if path is null). 

I'm unsure if you meant to provide a set of "format-template" to ImportError that are guarantied to be called with format(name=..., path=...) but I doubt it.
History
Date User Action Args
2017-02-15 00:51:41mbussonnsetrecipients: + mbussonn, barry, brett.cannon
2017-02-15 00:51:41mbussonnsetmessageid: <1487119901.86.0.718504995242.issue29546@psf.upfronthosting.co.za>
2017-02-15 00:51:41mbussonnlinkissue29546 messages
2017-02-15 00:51:41mbussonncreate