[New-bugs-announce] [issue25909] Incorrect documentation for PyMapping_Items and like

Serhiy Storchaka report at bugs.python.org
Sat Dec 19 06:38:05 EST 2015


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 at python
components: Documentation
messages: 256727
nosy: docs at 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 <report at bugs.python.org>
<http://bugs.python.org/issue25909>
_______________________________________


More information about the New-bugs-announce mailing list