@@ -1151,21 +1151,24 @@ Mapping Object Structures
11511151
11521152.. c :member :: lenfunc PyMappingMethods.mp_length
11531153
1154- This function is used by :c:func: `PyMapping_Length ` and
1154+ This function is used by :c:func: `PyMapping_Size ` and
11551155 :c:func: `PyObject_Size `, and has the same signature. This slot may be set to
11561156 *NULL * if the object has no defined length.
11571157
11581158.. c :member :: binaryfunc PyMappingMethods.mp_subscript
11591159
1160- This function is used by :c:func: `PyObject_GetItem ` and has the same
1161- signature. This slot must be filled for the :c:func: `PyMapping_Check `
1162- function to return ``1 ``, it can be *NULL * otherwise.
1160+ This function is used by :c:func: `PyObject_GetItem ` and
1161+ :c:func: `PySequence_GetSlice `, and has the same signature as
1162+ :c:func: `!PyObject_GetItem `. This slot must be filled for the
1163+ :c:func: `PyMapping_Check ` function to return ``1 ``, it can be *NULL *
1164+ otherwise.
11631165
11641166.. c :member :: objobjargproc PyMappingMethods.mp_ass_subscript
11651167
1166- This function is used by :c:func: `PyObject_SetItem ` and
1167- :c:func: `PyObject_DelItem `. It has the same signature as
1168- :c:func: `PyObject_SetItem `, but *v * can also be set to *NULL * to delete
1168+ This function is used by :c:func: `PyObject_SetItem `,
1169+ :c:func: `PyObject_DelItem `, :c:func: `PyObject_SetSlice ` and
1170+ :c:func: `PyObject_DelSlice `. It has the same signature as
1171+ :c:func: `!PyObject_SetItem `, but *v * can also be set to *NULL * to delete
11691172 an item. If this slot is *NULL *, the object does not support item
11701173 assignment and deletion.
11711174
@@ -1185,26 +1188,29 @@ Sequence Object Structures
11851188
11861189.. c :member :: lenfunc PySequenceMethods.sq_length
11871190
1188- This function is used by :c:func: `PySequence_Size ` and :c:func: `PyObject_Size `,
1189- and has the same signature.
1191+ This function is used by :c:func: `PySequence_Size ` and
1192+ :c:func: `PyObject_Size `, and has the same signature. It is also used for
1193+ handling negative indices via the :c:member: `~PySequenceMethods.sq_item `
1194+ and the :c:member: `~PySequenceMethods.sq_ass_item ` slots.
11901195
11911196.. c :member :: binaryfunc PySequenceMethods.sq_concat
11921197
11931198 This function is used by :c:func: `PySequence_Concat ` and has the same
11941199 signature. It is also used by the ``+ `` operator, after trying the numeric
1195- addition via the :c:member: `~PyTypeObject.tp_as_number .nb_add ` slot.
1200+ addition via the :c:member: `~PyNumberMethods .nb_add ` slot.
11961201
11971202.. c :member :: ssizeargfunc PySequenceMethods.sq_repeat
11981203
11991204 This function is used by :c:func: `PySequence_Repeat ` and has the same
12001205 signature. It is also used by the ``* `` operator, after trying numeric
1201- multiplication via the :c:member: `~PyTypeObject.tp_as_number.nb_multiply `
1202- slot.
1206+ multiplication via the :c:member: `~PyNumberMethods.nb_multiply ` slot.
12031207
12041208.. c :member :: ssizeargfunc PySequenceMethods.sq_item
12051209
12061210 This function is used by :c:func: `PySequence_GetItem ` and has the same
1207- signature. This slot must be filled for the :c:func: `PySequence_Check `
1211+ signature. It is also used by :c:func: `PyObject_GetItem `, after trying
1212+ the subscription via the :c:member: `~PyMappingMethods.mp_subscript ` slot.
1213+ This slot must be filled for the :c:func: `PySequence_Check `
12081214 function to return ``1 ``, it can be *NULL * otherwise.
12091215
12101216 Negative indexes are handled as follows: if the :attr: `sq_length ` slot is
@@ -1215,28 +1221,36 @@ Sequence Object Structures
12151221.. c :member :: ssizeobjargproc PySequenceMethods.sq_ass_item
12161222
12171223 This function is used by :c:func: `PySequence_SetItem ` and has the same
1218- signature. This slot may be left to *NULL * if the object does not support
1224+ signature. It is also used by :c:func: `PyObject_SetItem ` and
1225+ :c:func: `PyObject_DelItem `, after trying the item assignment and deletion
1226+ via the :c:member: `~PyMappingMethods.mp_ass_subscript ` slot.
1227+ This slot may be left to *NULL * if the object does not support
12191228 item assignment and deletion.
12201229
12211230.. c :member :: objobjproc PySequenceMethods.sq_contains
12221231
12231232 This function may be used by :c:func: `PySequence_Contains ` and has the same
12241233 signature. This slot may be left to *NULL *, in this case
1225- :c:func: `PySequence_Contains ` simply traverses the sequence until it finds a
1226- match.
1234+ :c:func: `! PySequence_Contains ` simply traverses the sequence until it
1235+ finds a match.
12271236
12281237.. c :member :: binaryfunc PySequenceMethods.sq_inplace_concat
12291238
12301239 This function is used by :c:func: `PySequence_InPlaceConcat ` and has the same
1231- signature. It should modify its first operand, and return it.
1240+ signature. It should modify its first operand, and return it. This slot
1241+ may be left to *NULL *, in this case :c:func: `!PySequence_InPlaceConcat `
1242+ will fall back to :c:func: `PySequence_Concat `. It is also used by the
1243+ augmented assignment ``+= ``, after trying numeric inplace addition
1244+ via the :c:member: `~PyNumberMethods.nb_inplace_add ` slot.
12321245
12331246.. c :member :: ssizeargfunc PySequenceMethods.sq_inplace_repeat
12341247
12351248 This function is used by :c:func: `PySequence_InPlaceRepeat ` and has the same
1236- signature. It should modify its first operand, and return it.
1237-
1238- .. XXX need to explain precedence between mapping and sequence
1239- .. XXX explains when to implement the sq_inplace_* slots
1249+ signature. It should modify its first operand, and return it. This slot
1250+ may be left to *NULL *, in this case :c:func: `!PySequence_InPlaceRepeat `
1251+ will fall back to :c:func: `PySequence_Repeat `. It is also used by the
1252+ augmented assignment ``*= ``, after trying numeric inplace multiplication
1253+ via the :c:member: `~PyNumberMethods.nb_inplace_multiply ` slot.
12401254
12411255
12421256.. _buffer-structs :
0 commit comments