[New-bugs-announce] [issue24067] Weakproxy is an instance of collections.Iterator

Eyal Reuveni report at bugs.python.org
Mon Apr 27 23:42:46 CEST 2015


New submission from Eyal Reuveni:

Calling weakref.proxy() on an object returns something that is an instance of collections.Iterator, regardless of whether the object is an instance of collections.Iterator or even if the object itself is iterable.

To reproduce, run the following code (verified in python2.7 and 3.4 on my Mac):

import collections
import weakref

class NotIterator:
    pass

not_iterator = NotIterator()
isinstance(not_iterator, collections.Iterator) # returns False

proxy_object = weakref.proxy(not_iterator)
isinstance(proxy_object, collections.Iterator) # returns True, should be False

----------
components: Library (Lib)
messages: 242159
nosy: ereuveni
priority: normal
severity: normal
status: open
title: Weakproxy is an instance of collections.Iterator
type: behavior
versions: Python 2.7, Python 3.4

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


More information about the New-bugs-announce mailing list