Message278794
@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). |
|
Date |
User |
Action |
Args |
2016-10-17 03:22:24 | ncoghlan | set | recipients:
+ 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:24 | ncoghlan | set | messageid: <1476674544.16.0.506204936243.issue21720@psf.upfronthosting.co.za> |
2016-10-17 03:22:24 | ncoghlan | link | issue21720 messages |
2016-10-17 03:22:22 | ncoghlan | create | |
|