[issue5218] Check for tp_iter in ceval:ext_do_call before overriding exception message

Guilherme Polo report at bugs.python.org
Wed Feb 11 20:32:43 CET 2009


New submission from Guilherme Polo <ggpolo at gmail.com>:

Hi,

I find it weird that given this sample code:

def g():
    yield iter(None)
list(*g())

I get this traceback:

Traceback (most recent call last):
  File "a1.py", line 3, in <module>
    list(*g())
TypeError: type object argument after * must be a sequence, not generator

At a minimum the exception message looks awkward to me. With the
proposed patch, the new traceback would be:

Traceback (most recent call last):
  File "a1.py", line 3, in <module>
    list(*g())
  File "a1.py", line 2, in g
    yield iter(None)
TypeError: 'NoneType' object is not iterable

----------
files: check_tpiter_before_overriding_msg.diff
keywords: patch
messages: 81657
nosy: gpolo
severity: normal
status: open
title: Check for tp_iter in ceval:ext_do_call before overriding exception message
Added file: http://bugs.python.org/file13035/check_tpiter_before_overriding_msg.diff

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


More information about the Python-bugs-list mailing list