Issue 7548: If a generator raises TypeError when being unpacked, an unrelated error message is shown (original) (raw)

list(('boo' for x in [1])) ['b', 'o', 'o'] list((range('error') for x in [1])) # notice the erroneous error message Traceback (most recent call last): File "", line 1, in TypeError: type object argument after * must be a sequence, not generator list([range('error') for x in [1]]) Traceback (most recent call last): File "", line 1, in TypeError: range() integer end argument expected, got str. list((int('error') for x in [1])) # does work correctly for ValueError Traceback (most recent call last): File "", line 1, in File "", line 1, in ValueError: invalid literal for int() with base 10: 'error'