@@ -1167,21 +1167,24 @@ Mapping Object Structures
11671167
11681168.. c :member :: lenfunc PyMappingMethods.mp_length
11691169
1170- This function is used by :c:func: `PyMapping_Length ` and
1170+ This function is used by :c:func: `PyMapping_Size ` and
11711171 :c:func: `PyObject_Size `, and has the same signature. This slot may be set to
11721172 *NULL * if the object has no defined length.
11731173
11741174.. c :member :: binaryfunc PyMappingMethods.mp_subscript
11751175
1176- This function is used by :c:func: `PyObject_GetItem ` and has the same
1177- signature. This slot must be filled for the :c:func: `PyMapping_Check `
1178- function to return ``1 ``, it can be *NULL * otherwise.
1176+ This function is used by :c:func: `PyObject_GetItem ` and
1177+ :c:func: `PySequence_GetSlice `, and has the same signature as
1178+ :c:func: `!PyObject_GetItem `. This slot must be filled for the
1179+ :c:func: `PyMapping_Check ` function to return ``1 ``, it can be *NULL *
1180+ otherwise.
11791181
11801182.. c :member :: objobjargproc PyMappingMethods.mp_ass_subscript
11811183
1182- This function is used by :c:func: `PyObject_SetItem ` and
1183- :c:func: `PyObject_DelItem `. It has the same signature as
1184- :c:func: `PyObject_SetItem `, but *v * can also be set to *NULL * to delete
1184+ This function is used by :c:func: `PyObject_SetItem `,
1185+ :c:func: `PyObject_DelItem `, :c:func: `PyObject_SetSlice ` and
1186+ :c:func: `PyObject_DelSlice `. It has the same signature as
1187+ :c:func: `!PyObject_SetItem `, but *v * can also be set to *NULL * to delete
11851188 an item. If this slot is *NULL *, the object does not support item
11861189 assignment and deletion.
11871190
@@ -1201,26 +1204,29 @@ Sequence Object Structures
12011204
12021205.. c :member :: lenfunc PySequenceMethods.sq_length
12031206
1204- This function is used by :c:func: `PySequence_Size ` and :c:func: `PyObject_Size `,
1205- and has the same signature.
1207+ This function is used by :c:func: `PySequence_Size ` and
1208+ :c:func: `PyObject_Size `, and has the same signature. It is also used for
1209+ handling negative indices via the :c:member: `~PySequenceMethods.sq_item `
1210+ and the :c:member: `~PySequenceMethods.sq_ass_item ` slots.
12061211
12071212.. c :member :: binaryfunc PySequenceMethods.sq_concat
12081213
12091214 This function is used by :c:func: `PySequence_Concat ` and has the same
12101215 signature. It is also used by the ``+ `` operator, after trying the numeric
1211- addition via the :c:member: `~PyTypeObject.tp_as_number .nb_add ` slot.
1216+ addition via the :c:member: `~PyNumberMethods .nb_add ` slot.
12121217
12131218.. c :member :: ssizeargfunc PySequenceMethods.sq_repeat
12141219
12151220 This function is used by :c:func: `PySequence_Repeat ` and has the same
12161221 signature. It is also used by the ``* `` operator, after trying numeric
1217- multiplication via the :c:member: `~PyTypeObject.tp_as_number.nb_multiply `
1218- slot.
1222+ multiplication via the :c:member: `~PyNumberMethods.nb_multiply ` slot.
12191223
12201224.. c :member :: ssizeargfunc PySequenceMethods.sq_item
12211225
12221226 This function is used by :c:func: `PySequence_GetItem ` and has the same
1223- signature. This slot must be filled for the :c:func: `PySequence_Check `
1227+ signature. It is also used by :c:func: `PyObject_GetItem `, after trying
1228+ the subscription via the :c:member: `~PyMappingMethods.mp_subscript ` slot.
1229+ This slot must be filled for the :c:func: `PySequence_Check `
12241230 function to return ``1 ``, it can be *NULL * otherwise.
12251231
12261232 Negative indexes are handled as follows: if the :attr: `sq_length ` slot is
@@ -1231,28 +1237,36 @@ Sequence Object Structures
12311237.. c :member :: ssizeobjargproc PySequenceMethods.sq_ass_item
12321238
12331239 This function is used by :c:func: `PySequence_SetItem ` and has the same
1234- signature. This slot may be left to *NULL * if the object does not support
1240+ signature. It is also used by :c:func: `PyObject_SetItem ` and
1241+ :c:func: `PyObject_DelItem `, after trying the item assignment and deletion
1242+ via the :c:member: `~PyMappingMethods.mp_ass_subscript ` slot.
1243+ This slot may be left to *NULL * if the object does not support
12351244 item assignment and deletion.
12361245
12371246.. c :member :: objobjproc PySequenceMethods.sq_contains
12381247
12391248 This function may be used by :c:func: `PySequence_Contains ` and has the same
12401249 signature. This slot may be left to *NULL *, in this case
1241- :c:func: `PySequence_Contains ` simply traverses the sequence until it finds a
1242- match.
1250+ :c:func: `! PySequence_Contains ` simply traverses the sequence until it
1251+ finds a match.
12431252
12441253.. c :member :: binaryfunc PySequenceMethods.sq_inplace_concat
12451254
12461255 This function is used by :c:func: `PySequence_InPlaceConcat ` and has the same
1247- signature. It should modify its first operand, and return it.
1256+ signature. It should modify its first operand, and return it. This slot
1257+ may be left to *NULL *, in this case :c:func: `!PySequence_InPlaceConcat `
1258+ will fall back to :c:func: `PySequence_Concat `. It is also used by the
1259+ augmented assignment ``+= ``, after trying numeric inplace addition
1260+ via the :c:member: `~PyNumberMethods.nb_inplace_add ` slot.
12481261
12491262.. c :member :: ssizeargfunc PySequenceMethods.sq_inplace_repeat
12501263
12511264 This function is used by :c:func: `PySequence_InPlaceRepeat ` and has the same
1252- signature. It should modify its first operand, and return it.
1253-
1254- .. XXX need to explain precedence between mapping and sequence
1255- .. XXX explains when to implement the sq_inplace_* slots
1265+ signature. It should modify its first operand, and return it. This slot
1266+ may be left to *NULL *, in this case :c:func: `!PySequence_InPlaceRepeat `
1267+ will fall back to :c:func: `PySequence_Repeat `. It is also used by the
1268+ augmented assignment ``*= ``, after trying numeric inplace multiplication
1269+ via the :c:member: `~PyNumberMethods.nb_inplace_multiply ` slot.
12561270
12571271
12581272.. _buffer-structs :
0 commit comments