@@ -28,30 +28,28 @@ See also :c:func:`PyObject_GetItem`, :c:func:`PyObject_SetItem` and
28
28
29
29
.. c :function :: PyObject* PyMapping_GetItemString (PyObject *o, const char *key)
30
30
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* `.
34
34
35
35
36
36
.. c :function :: int PyMapping_SetItemString (PyObject *o, const char *key, PyObject *v)
37
37
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* `.
42
41
43
42
44
43
.. c :function :: int PyMapping_DelItem (PyObject *o, PyObject *key)
45
44
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] ``.
48
45
This is an alias of :c:func: `PyObject_DelItem `.
49
46
50
47
51
48
.. c :function :: int PyMapping_DelItemString (PyObject *o, const char *key)
52
49
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* `.
55
53
56
54
57
55
.. c :function :: int PyMapping_HasKey (PyObject *o, PyObject *key)
@@ -60,20 +58,25 @@ See also :c:func:`PyObject_GetItem`, :c:func:`PyObject_SetItem` and
60
58
This is equivalent to the Python expression ``key in o ``.
61
59
This function always succeeds.
62
60
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.
66
66
67
67
68
68
.. c :function :: int PyMapping_HasKeyString (PyObject *o, const char *key)
69
69
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 ::
73
75
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.
77
80
78
81
79
82
.. c :function :: PyObject* PyMapping_Keys (PyObject *o)
0 commit comments