New submission from Serhiy Storchaka:

The documentation and comments for PyMapping_Items, PyMapping_Keys and 
PyMapping_Values are not correct about return type.

The documentation says that return type is a list. For example for 
PyMapping_Items:

   On success, return a list of the items in object *o*, where each item is a 
tuple
   containing a key-value pair.  On failure, return *NULL*. This is equivalent 
to
   the Python expression ``list(o.items())``.

The comment in Include/abstract.h is more correct, it mentions tuple:

     On success, return a list or tuple of the items in object o,
     where each item is a tuple containing a key-value pair.
     On failure, return NULL.

Actually PyMapping_Items in 3.x can return a list, a tuple, or a dict view (for 
dict).

The same for PyMapping_Keys and PyMapping_Values.

----------
assignee: docs@python
components: Documentation
messages: 256727
nosy: docs@python, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Incorrect documentation for PyMapping_Items and like
type: behavior
versions: Python 3.5, Python 3.6

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

Reply via email to