[New-bugs-announce] [issue37976] zip() shadows TypeError raised in __iter__() of source iterable

Sergey Fedoseev report at bugs.python.org
Thu Aug 29 06:30:10 EDT 2019


New submission from Sergey Fedoseev <fedoseev.sergey at gmail.com>:

zip() shadows TypeError raised in __iter__() of source iterable:

In [21]: class Iterable:
    ...:     def __init__(self, n):
    ...:         self.n = n
    ...:     def __iter__(self):
    ...:         return iter(range(self.n))
    ...:     

In [22]: zip(Iterable('one'))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-22-66835be83afa> in <module>()
----> 1 zip(Iterable('one'))

TypeError: zip argument #1 must support iteration

----------
messages: 350763
nosy: sir-sigurd
priority: normal
severity: normal
status: open
title: zip() shadows TypeError raised in __iter__() of source iterable

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37976>
_______________________________________


More information about the New-bugs-announce mailing list