New submission from behzad nouri:

- python 2 only, not reproducible on python 3

Attached file makes an extension module which just returns PyIter_Check value 
on passed object.

Calling the function with an object of type "instance" returns true, even 
though the object is not iterator:


    >>> import spam
    >>> class Foo:
    ...     pass
    ... 
    >>> foo = Foo()
    >>> type(foo)
    <type 'instance'>
    >>> spam.isiter(foo)  # <<<< ?!
    1
    >>> next(foo)
    TypeError: instance has no next() method

----------
components: Interpreter Core
files: spammodule.c
messages: 242866
nosy: behzad.nouri
priority: normal
severity: normal
status: open
title: PyIter_Check returns false positive for objects of type instance
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file39335/spammodule.c

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24161>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to