classification
Title: If a generator raises TypeError when being unpacked, an unrelated error message is shown
Type: Stage:
Components: Interpreter Core Versions: Python 3.0, Python 2.4, Python 3.1, Python 3.2, Python 2.7, Python 2.6, Python 2.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Function calls taking a generator as star argument can mask TypeErrors in the generator
View: 4806
Assigned To: Nosy List: amaury.forgeotdarc, eggy
Priority: normal Keywords:

Created on 2009-12-19 19:26 by eggy, last changed 2009-12-29 16:41 by amaury.forgeotdarc. This issue is now closed.

Messages (2)
msg96642 - (view) Author: Mark Florisson (eggy) * Date: 2009-12-19 19:26
>>> 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 "<stdin>", line 1, in <module>
TypeError: type object argument after * must be a sequence, not 
generator
>>> list(*[range('error') for x in [1]])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
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 "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <genexpr>
ValueError: invalid literal for int() with base 10: 'error'
msg96997 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-12-29 16:41
This is a duplicate of issue4806.
History
Date User Action Args
2009-12-29 16:41:47amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg96997

superseder: Function calls taking a generator as star argument can mask TypeErrors in the generator
resolution: duplicate
2009-12-19 19:26:12eggycreate