@@ -28,30 +28,28 @@ See also :c:func:`PyObject_GetItem`, :c:func:`PyObject_SetItem` and
2828
2929.. c :function :: PyObject* PyMapping_GetItemString (PyObject *o, const char *key)
3030
31- Return element of * o * corresponding to the string *key * or `` NULL `` on failure.
32- This is the equivalent of the Python expression `` o[key] ``.
33- See also :c:func: ` PyObject_GetItem `.
31+ This is the same as :c:func: ` PyObject_GetItem `, but *key * is
32+ specified as a :c:expr: ` const char* ` UTF-8 encoded bytes string,
33+ rather than a :c:expr: ` PyObject* `.
3434
3535
3636.. c :function :: int PyMapping_SetItemString (PyObject *o, const char *key, PyObject *v)
3737
38- Map the string *key * to the value *v * in object *o *. Returns ``-1 `` on
39- failure. This is the equivalent of the Python statement ``o[key] = v ``.
40- See also :c:func: `PyObject_SetItem `. This function *does not * steal a
41- reference to *v *.
38+ This is the same as :c:func: `PyObject_SetItem `, but *key * is
39+ specified as a :c:expr: `const char* ` UTF-8 encoded bytes string,
40+ rather than a :c:expr: `PyObject* `.
4241
4342
4443.. c :function :: int PyMapping_DelItem (PyObject *o, PyObject *key)
4544
46- Remove the mapping for the object *key * from the object *o *. Return ``-1 ``
47- on failure. This is equivalent to the Python statement ``del o[key] ``.
4845 This is an alias of :c:func: `PyObject_DelItem `.
4946
5047
5148.. c :function :: int PyMapping_DelItemString (PyObject *o, const char *key)
5249
53- Remove the mapping for the string *key * from the object *o *. Return ``-1 ``
54- on failure. This is equivalent to the Python statement ``del o[key] ``.
50+ This is the same as :c:func: `PyObject_DelItem `, but *key * is
51+ specified as a :c:expr: `const char* ` UTF-8 encoded bytes string,
52+ rather than a :c:expr: `PyObject* `.
5553
5654
5755.. c :function :: int PyMapping_HasKey (PyObject *o, PyObject *key)
@@ -60,20 +58,25 @@ See also :c:func:`PyObject_GetItem`, :c:func:`PyObject_SetItem` and
6058 This is equivalent to the Python expression ``key in o ``.
6159 This function always succeeds.
6260
63- Note that exceptions which occur while calling the :meth: `~object.__getitem__ `
64- method will get suppressed.
65- To get error reporting use :c:func: `PyObject_GetItem() ` instead.
61+ .. note ::
62+
63+ Exceptions which occur when this calls :meth: `~object.__getitem__ `
64+ method are silently ignored.
65+ For proper error handling, use :c:func: `PyObject_GetItem() ` instead.
6666
6767
6868.. c :function :: int PyMapping_HasKeyString (PyObject *o, const char *key)
6969
70- Return ``1 `` if the mapping object has the key *key * and ``0 `` otherwise.
71- This is equivalent to the Python expression ``key in o ``.
72- This function always succeeds.
70+ This is the same as :c:func: `PyMapping_HasKey `, but *key * is
71+ specified as a :c:expr: `const char* ` UTF-8 encoded bytes string,
72+ rather than a :c:expr: `PyObject* `.
73+
74+ .. note ::
7375
74- Note that exceptions which occur while calling the :meth: `~object.__getitem__ `
75- method and creating a temporary string object will get suppressed.
76- To get error reporting use :c:func: `PyMapping_GetItemString() ` instead.
76+ Exceptions that occur when this calls :meth: `~object.__getitem__ `
77+ method or while creating the temporary :class: `str `
78+ object are silently ignored.
79+ For proper error handling, use :c:func: `PyMapping_GetItemString ` instead.
7780
7881
7982.. c :function :: PyObject* PyMapping_Keys (PyObject *o)
0 commit comments