Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue7321] PyIter_Check(obj) fails when obj is of type PySetType

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 14, 2009, 1:08 AM

Post #1 of 2 (199 views)
Permalink
[issue7321] PyIter_Check(obj) fails when obj is of type PySetType

New submission from Damian Eads <damian.eads [at] gmail>:

The instructions for the C interface to the Python set class

http://docs.python.org/c-api/set.html

say to use PyObject_GetIter and follow the iterator protocol. After
following the instructions for the iterator protocol here,

http://docs.python.org/c-api/iter.html

I was able to successfully iterate through a set object. However,
PyIter_Check(obj) returns false yet set objects follow the iterator
protocol. Is this the correct behavior?

Thank you.

Kind regards,

Damian Eads

----------
messages: 95229
nosy: damianeads
severity: normal
status: open
title: PyIter_Check(obj) fails when obj is of type PySetType
versions: Python 2.6

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7321>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 14, 2009, 5:42 AM

Post #2 of 2 (188 views)
Permalink
[issue7321] PyIter_Check(obj) fails when obj is of type PySetType [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

Set objects are iterable, they are not iterators themselves.
In other words, PyIter_Check() should return true when called with the
result of PyObject_GetIter() (but normally you don't need to check anyway).

----------
nosy: +pitrou
resolution: -> invalid
status: open -> closed

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7321>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.