Skip to content

Commit 0c7abc1

Browse files
jbarlow83James R. Barlow
authored andcommitted
mapping.rst: PyMapping_Check(list) returns 1
As discussed below, in Python 3, PyMapping_Check(list) returns 1. This behavior is justified by a developer as consistent with Python 3's internals. It is however surprising to C-API users (speaking from experience) and because it deviates from collections.abc.Mapping. https://mail.python.org/pipermail/python-dev/2009-May/089445.html Squashed a few revisions
1 parent 370f7a9 commit 0c7abc1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Doc/c-api/mapping.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Mapping Protocol
99
.. c:function:: int PyMapping_Check(PyObject *o)
1010
1111
Return ``1`` if the object provides mapping protocol, and ``0`` otherwise. This
12-
function always succeeds.
12+
function always succeeds. The C-API mapping protocol is not equivalent to
13+
:class:`collections.abc.Mapping`. In particular, ``PyMapping_Check(list)``
14+
returns ``1``.
1315
1416
1517
.. c:function:: Py_ssize_t PyMapping_Size(PyObject *o)

0 commit comments

Comments
 (0)