@@ -33,25 +33,27 @@ Tuple Objects
33
33
34
34
.. c :function :: PyObject* PyTuple_New (Py_ssize_t len)
35
35
36
- Return a new tuple object of size *len*, or ``NULL`` on failure.
36
+ Return a new tuple object of size *len*,
37
+ or ``NULL`` with an exception set on failure.
37
38
38
39
39
40
.. c:function:: PyObject* PyTuple_Pack(Py_ssize_t n, ...)
40
41
41
- Return a new tuple object of size *n*, or ``NULL`` on failure. The tuple values
42
+ Return a new tuple object of size *n*,
43
+ or ``NULL`` with an exception set on failure. The tuple values
42
44
are initialized to the subsequent *n* C arguments pointing to Python objects.
43
45
``PyTuple_Pack(2, a, b)`` is equivalent to ``Py_BuildValue("(OO)", a, b)``.
44
46
45
47
46
48
.. c:function:: Py_ssize_t PyTuple_Size(PyObject *p)
47
49
48
50
Take a pointer to a tuple object, and return the size of that tuple.
51
+ On error, return ``-1 `` and with an exception set.
49
52
50
53
51
54
.. c :function :: Py_ssize_t PyTuple_GET_SIZE (PyObject *p)
52
55
53
- Return the size of the tuple *p *, which must be non-``NULL `` and point to a tuple;
54
- no error checking is performed.
56
+ Like :c:func: `PyTuple_Size `, but without error checking.
55
57
56
58
57
59
.. c :function :: PyObject* PyTuple_GetItem (PyObject *p, Py_ssize_t pos)
@@ -74,8 +76,10 @@ Tuple Objects
74
76
.. c :function :: PyObject* PyTuple_GetSlice (PyObject *p, Py_ssize_t low, Py_ssize_t high)
75
77
76
78
Return the slice of the tuple pointed to by *p * between *low * and *high *,
77
- or ``NULL `` on failure. This is the equivalent of the Python expression
78
- ``p[low:high] ``. Indexing from the end of the tuple is not supported.
79
+ or ``NULL `` with an exception set on failure.
80
+
81
+ This is the equivalent of the Python expression ``p[low:high] ``.
82
+ Indexing from the end of the tuple is not supported.
79
83
80
84
81
85
.. c :function :: int PyTuple_SetItem (PyObject *p, Py_ssize_t pos, PyObject *o)
@@ -132,6 +136,8 @@ type.
132
136
Create a new struct sequence type from the data in *desc *, described below. Instances
133
137
of the resulting type can be created with :c:func: `PyStructSequence_New `.
134
138
139
+ Return ``NULL `` with an exception set on failure.
140
+
135
141
136
142
.. c :function :: void PyStructSequence_InitType (PyTypeObject *type, PyStructSequence_Desc *desc)
137
143
@@ -140,8 +146,8 @@ type.
140
146
141
147
.. c :function :: int PyStructSequence_InitType2 (PyTypeObject *type, PyStructSequence_Desc *desc)
142
148
143
- The same as `` PyStructSequence_InitType `` , but returns ``0 `` on success and `` -1 `` on
144
- failure.
149
+ Like :c:func: ` PyStructSequence_InitType `, but returns ``0 `` on success
150
+ and `` -1 `` with an exception set on failure.
145
151
146
152
.. versionadded :: 3.4
147
153
@@ -198,6 +204,8 @@ type.
198
204
Creates an instance of *type *, which must have been created with
199
205
:c:func: `PyStructSequence_NewType `.
200
206
207
+ Return ``NULL `` with an exception set on failure.
208
+
201
209
202
210
.. c :function :: PyObject* PyStructSequence_GetItem (PyObject *p, Py_ssize_t pos)
203
211
0 commit comments