This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients Julian.Gindi, Tim.Graham, berker.peksag, bignose, brett.cannon, davidszotten@gmail.com, eric.snow, ezio.melotti, ncoghlan, python-dev, rhettinger, serhiy.storchaka
Date 2016-10-17.03:22:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1476674544.16.0.506204936243.issue21720@psf.upfronthosting.co.za>
In-reply-to
Content
@Berker: the warning under "-bb" is a separate issue related to the handling of wildcard imports (_handle_fromlist searches for '*' and then pops it from a copy of the input list, replacing it with __all__ if that's defined)

@Ben: As a general principle, we don't give value information in type errors, since the error is structural rather than value based. The closest equivalent to us doing that that I'm aware of is the sequence index being given in str.join's TypeError:

    >>> "".join(["a", "b", b"c"])
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: sequence item 2: expected str instance, bytes found

By contrast, when sorting, we don't give *any* indication as to where in the sequence the problem was found or the specific values involved:

    >>> sorted(["a", "b", b"c"])
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: unorderable types: bytes() < str()

That doesn't make it a bad idea (as I think you're right that it would often make debugging easier), I'd just prefer to consider that as a separate question rather than introducing a one-off inconsistency with the general policy here (in particular, encountering TypeError is far more likely with str.join and sorted than it is with __import__, so it would be genuinely weird for the latter to have the most helpful error message).
History
Date User Action Args
2016-10-17 03:22:24ncoghlansetrecipients: + ncoghlan, brett.cannon, rhettinger, ezio.melotti, bignose, python-dev, eric.snow, berker.peksag, serhiy.storchaka, Julian.Gindi, davidszotten@gmail.com, Tim.Graham
2016-10-17 03:22:24ncoghlansetmessageid: <1476674544.16.0.506204936243.issue21720@psf.upfronthosting.co.za>
2016-10-17 03:22:24ncoghlanlinkissue21720 messages
2016-10-17 03:22:22ncoghlancreate