[Python-checkins] cpython (2.7): Issue #24161: Document that PyIter_Check() returns false positives for

raymond.hettinger python-checkins at python.org
Mon May 11 19:22:32 CEST 2015


https://hg.python.org/cpython/rev/0f7795edca65
changeset:   95950:0f7795edca65
branch:      2.7
parent:      95947:5c29bbcad278
user:        Raymond Hettinger <python at rcn.com>
date:        Mon May 11 10:22:20 2015 -0700
summary:
  Issue #24161:  Document that PyIter_Check() returns false positives for old-style instances.

files:
  Doc/c-api/iter.rst |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Doc/c-api/iter.rst b/Doc/c-api/iter.rst
--- a/Doc/c-api/iter.rst
+++ b/Doc/c-api/iter.rst
@@ -14,6 +14,10 @@
 
    Return true if the object *o* supports the iterator protocol.
 
+   This function can return a false positive in the case of old-style
+   classes because those classes always define a :c:member:`tp_iternext`
+   slot with logic that either invokes a :meth:`next` method or raises
+   a :exc:`TypeError`.
 
 .. c:function:: PyObject* PyIter_Next(PyObject *o)
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list