[New-bugs-announce] [issue7548] If a generator raises TypeError when being unpacked, an unrelated error message is shown

Mark Florisson report at bugs.python.org
Sat Dec 19 20:26:13 CET 2009


New submission from Mark Florisson <markflorisson88 at gmail.com>:

>>> 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'

----------
components: Interpreter Core
messages: 96642
nosy: eggy
severity: normal
status: open
title: If a generator raises TypeError when being unpacked, an unrelated error message is shown
versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7548>
_______________________________________


More information about the New-bugs-announce mailing list