@@ -129,17 +129,17 @@ which disallows mutable objects such as :class:`bytearray`.
129
129
``S `` (:class: `bytes `) [PyBytesObject \* ]
130
130
Requires that the Python object is a :class: `bytes ` object, without
131
131
attempting any conversion. Raises :exc: `TypeError ` if the object is not
132
- a bytes object. The C variable may also be declared as :c:type : `PyObject* `.
132
+ a bytes object. The C variable may also be declared as :c:expr : `PyObject* `.
133
133
134
134
``Y `` (:class: `bytearray `) [PyByteArrayObject \* ]
135
135
Requires that the Python object is a :class: `bytearray ` object, without
136
136
attempting any conversion. Raises :exc: `TypeError ` if the object is not
137
- a :class: `bytearray ` object. The C variable may also be declared as :c:type : `PyObject* `.
137
+ a :class: `bytearray ` object. The C variable may also be declared as :c:expr : `PyObject* `.
138
138
139
139
``U `` (:class: `str `) [PyObject \* ]
140
140
Requires that the Python object is a Unicode object, without attempting
141
141
any conversion. Raises :exc: `TypeError ` if the object is not a Unicode
142
- object. The C variable may also be declared as :c:type : `PyObject* `.
142
+ object. The C variable may also be declared as :c:expr : `PyObject* `.
143
143
144
144
``w* `` (read-write :term: `bytes-like object `) [Py_buffer]
145
145
This format accepts any object which implements the read-write buffer
@@ -152,10 +152,10 @@ which disallows mutable objects such as :class:`bytearray`.
152
152
It only works for encoded data without embedded NUL bytes.
153
153
154
154
This format requires two arguments. The first is only used as input, and
155
- must be a :c:type : `const char* ` which points to the name of an encoding as a
155
+ must be a :c:expr : `const char* ` which points to the name of an encoding as a
156
156
NUL-terminated string, or ``NULL ``, in which case ``'utf-8' `` encoding is used.
157
157
An exception is raised if the named encoding is not known to Python. The
158
- second argument must be a :c:type : `char** `; the value of the pointer it
158
+ second argument must be a :c:expr : `char** `; the value of the pointer it
159
159
references will be set to a buffer with the contents of the argument text.
160
160
The text will be encoded in the encoding specified by the first argument.
161
161
@@ -175,10 +175,10 @@ which disallows mutable objects such as :class:`bytearray`.
175
175
characters.
176
176
177
177
It requires three arguments. The first is only used as input, and must be a
178
- :c:type : `const char* ` which points to the name of an encoding as a
178
+ :c:expr : `const char* ` which points to the name of an encoding as a
179
179
NUL-terminated string, or ``NULL ``, in which case ``'utf-8' `` encoding is used.
180
180
An exception is raised if the named encoding is not known to Python. The
181
- second argument must be a :c:type : `char** `; the value of the pointer it
181
+ second argument must be a :c:expr : `char** `; the value of the pointer it
182
182
references will be set to a buffer with the contents of the argument text.
183
183
The text will be encoded in the encoding specified by the first argument.
184
184
The third argument must be a pointer to an integer; the referenced integer
@@ -215,59 +215,59 @@ Numbers
215
215
216
216
``b `` (:class: `int `) [unsigned char]
217
217
Convert a nonnegative Python integer to an unsigned tiny int, stored in a C
218
- :c:type : `unsigned char `.
218
+ :c:expr : `unsigned char `.
219
219
220
220
``B `` (:class: `int `) [unsigned char]
221
221
Convert a Python integer to a tiny int without overflow checking, stored in a C
222
- :c:type : `unsigned char `.
222
+ :c:expr : `unsigned char `.
223
223
224
224
``h `` (:class: `int `) [short int]
225
- Convert a Python integer to a C :c:type : `short int `.
225
+ Convert a Python integer to a C :c:expr : `short int `.
226
226
227
227
``H `` (:class: `int `) [unsigned short int]
228
- Convert a Python integer to a C :c:type : `unsigned short int `, without overflow
228
+ Convert a Python integer to a C :c:expr : `unsigned short int `, without overflow
229
229
checking.
230
230
231
231
``i `` (:class: `int `) [int]
232
- Convert a Python integer to a plain C :c:type : `int `.
232
+ Convert a Python integer to a plain C :c:expr : `int `.
233
233
234
234
``I `` (:class: `int `) [unsigned int]
235
- Convert a Python integer to a C :c:type : `unsigned int `, without overflow
235
+ Convert a Python integer to a C :c:expr : `unsigned int `, without overflow
236
236
checking.
237
237
238
238
``l `` (:class: `int `) [long int]
239
- Convert a Python integer to a C :c:type : `long int `.
239
+ Convert a Python integer to a C :c:expr : `long int `.
240
240
241
241
``k `` (:class: `int `) [unsigned long]
242
- Convert a Python integer to a C :c:type : `unsigned long ` without
242
+ Convert a Python integer to a C :c:expr : `unsigned long ` without
243
243
overflow checking.
244
244
245
245
``L `` (:class: `int `) [long long]
246
- Convert a Python integer to a C :c:type : `long long `.
246
+ Convert a Python integer to a C :c:expr : `long long `.
247
247
248
248
``K `` (:class: `int `) [unsigned long long]
249
- Convert a Python integer to a C :c:type : `unsigned long long `
249
+ Convert a Python integer to a C :c:expr : `unsigned long long `
250
250
without overflow checking.
251
251
252
252
``n `` (:class: `int `) [:c:type: `Py_ssize_t `]
253
253
Convert a Python integer to a C :c:type: `Py_ssize_t `.
254
254
255
255
``c `` (:class: `bytes ` or :class: `bytearray ` of length 1) [char]
256
256
Convert a Python byte, represented as a :class: `bytes ` or
257
- :class: `bytearray ` object of length 1, to a C :c:type : `char `.
257
+ :class: `bytearray ` object of length 1, to a C :c:expr : `char `.
258
258
259
259
.. versionchanged :: 3.3
260
260
Allow :class: `bytearray ` objects.
261
261
262
262
``C `` (:class: `str ` of length 1) [int]
263
263
Convert a Python character, represented as a :class: `str ` object of
264
- length 1, to a C :c:type : `int `.
264
+ length 1, to a C :c:expr : `int `.
265
265
266
266
``f `` (:class: `float `) [float]
267
- Convert a Python floating point number to a C :c:type : `float `.
267
+ Convert a Python floating point number to a C :c:expr : `float `.
268
268
269
269
``d `` (:class: `float `) [double]
270
- Convert a Python floating point number to a C :c:type : `double `.
270
+ Convert a Python floating point number to a C :c:expr : `double `.
271
271
272
272
``D `` (:class: `complex `) [Py_complex]
273
273
Convert a Python complex number to a C :c:type: `Py_complex ` structure.
@@ -283,7 +283,7 @@ Other objects
283
283
``O! `` (object) [*typeobject *, PyObject \* ]
284
284
Store a Python object in a C object pointer. This is similar to ``O ``, but
285
285
takes two C arguments: the first is the address of a Python type object, the
286
- second is the address of the C variable (of type :c:type : `PyObject* `) into which
286
+ second is the address of the C variable (of type :c:expr : `PyObject* `) into which
287
287
the object pointer is stored. If the Python object does not have the required
288
288
type, :exc: `TypeError ` is raised.
289
289
@@ -292,13 +292,13 @@ Other objects
292
292
``O& `` (object) [*converter *, *anything *]
293
293
Convert a Python object to a C variable through a *converter * function. This
294
294
takes two arguments: the first is a function, the second is the address of a C
295
- variable (of arbitrary type), converted to :c:type : `void * `. The *converter *
295
+ variable (of arbitrary type), converted to :c:expr : `void * `. The *converter *
296
296
function in turn is called as follows::
297
297
298
298
status = converter(object, address);
299
299
300
300
where *object * is the Python object to be converted and *address * is the
301
- :c:type : `void* ` argument that was passed to the :c:func: ` PyArg_Parse\* ` function.
301
+ :c:expr : `void* ` argument that was passed to the `` PyArg_Parse* ` ` function.
302
302
The returned *status * should be ``1 `` for a successful conversion and ``0 `` if
303
303
the conversion has failed. When the conversion fails, the *converter * function
304
304
should raise an exception and leave the content of *address * unmodified.
@@ -372,9 +372,9 @@ what is specified for the corresponding format unit in that case.
372
372
373
373
For the conversion to succeed, the *arg * object must match the format
374
374
and the format must be exhausted. On success, the
375
- :c:func: ` PyArg_Parse\* ` functions return true, otherwise they return
375
+ `` PyArg_Parse* ` ` functions return true, otherwise they return
376
376
false and raise an appropriate exception. When the
377
- :c:func: ` PyArg_Parse\* ` functions fail due to conversion failure in one
377
+ `` PyArg_Parse* ` ` functions fail due to conversion failure in one
378
378
of the format units, the variables at the addresses corresponding to that
379
379
and the following format units are left untouched.
380
380
@@ -444,7 +444,7 @@ API Functions
444
444
*args *; it must actually be a tuple. The length of the tuple must be at least
445
445
*min * and no more than *max *; *min * and *max * may be equal. Additional
446
446
arguments must be passed to the function, each of which should be a pointer to a
447
- :c:type : `PyObject* ` variable; these will be filled in with the values from
447
+ :c:expr : `PyObject* ` variable; these will be filled in with the values from
448
448
*args *; they will contain :term: `borrowed references <borrowed reference> `.
449
449
The variables which correspond
450
450
to optional parameters not given by *args * will not be filled in; these should
@@ -481,7 +481,7 @@ Building values
481
481
.. c :function :: PyObject* Py_BuildValue (const char *format, ...)
482
482
483
483
Create a new value based on a format string similar to those accepted by the
484
- :c:func: ` PyArg_Parse\* ` family of functions and a sequence of values. Returns
484
+ `` PyArg_Parse* ` ` family of functions and a sequence of values. Returns
485
485
the value or ``NULL `` in the case of an error; an exception will be raised if
486
486
``NULL `` is returned.
487
487
@@ -531,7 +531,7 @@ Building values
531
531
Same as ``s#``.
532
532
533
533
``u `` (:class: `str `) [const wchar_t \*]
534
- Convert a null-terminated :c:type :`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
534
+ Convert a null-terminated :c:expr :`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
535
535
data to a Python Unicode object. If the Unicode buffer pointer is ``NULL``,
536
536
``None`` is returned.
537
537
@@ -547,51 +547,51 @@ Building values
547
547
Same as ``s#``.
548
548
549
549
``i `` (:class: `int `) [int]
550
- Convert a plain C :c:type :`int` to a Python integer object.
550
+ Convert a plain C :c:expr :`int` to a Python integer object.
551
551
552
552
``b`` (:class: `int `) [char]
553
- Convert a plain C :c:type :`char` to a Python integer object.
553
+ Convert a plain C :c:expr :`char` to a Python integer object.
554
554
555
555
``h`` (:class: `int `) [short int]
556
- Convert a plain C :c:type :`short int` to a Python integer object.
556
+ Convert a plain C :c:expr :`short int` to a Python integer object.
557
557
558
558
``l`` (:class: `int `) [long int]
559
- Convert a C :c:type :`long int` to a Python integer object.
559
+ Convert a C :c:expr :`long int` to a Python integer object.
560
560
561
561
``B`` (:class: `int `) [unsigned char]
562
- Convert a C :c:type :`unsigned char` to a Python integer object.
562
+ Convert a C :c:expr :`unsigned char` to a Python integer object.
563
563
564
564
``H`` (:class: `int `) [unsigned short int]
565
- Convert a C :c:type :`unsigned short int` to a Python integer object.
565
+ Convert a C :c:expr :`unsigned short int` to a Python integer object.
566
566
567
567
``I`` (:class: `int `) [unsigned int]
568
- Convert a C :c:type :`unsigned int` to a Python integer object.
568
+ Convert a C :c:expr :`unsigned int` to a Python integer object.
569
569
570
570
``k`` (:class: `int `) [unsigned long]
571
- Convert a C :c:type :`unsigned long` to a Python integer object.
571
+ Convert a C :c:expr :`unsigned long` to a Python integer object.
572
572
573
573
``L`` (:class: `int `) [long long]
574
- Convert a C :c:type :`long long` to a Python integer object.
574
+ Convert a C :c:expr :`long long` to a Python integer object.
575
575
576
576
``K`` (:class: `int `) [unsigned long long]
577
- Convert a C :c:type :`unsigned long long` to a Python integer object.
577
+ Convert a C :c:expr :`unsigned long long` to a Python integer object.
578
578
579
579
``n`` (:class: `int `) [:c:type:`Py_ssize_t`]
580
580
Convert a C :c:type:`Py_ssize_t` to a Python integer.
581
581
582
582
``c`` (:class: `bytes ` of length 1) [char]
583
- Convert a C :c:type :`int` representing a byte to a Python :class:`bytes` object of
583
+ Convert a C :c:expr :`int` representing a byte to a Python :class:`bytes` object of
584
584
length 1.
585
585
586
586
``C`` (:class: `str ` of length 1) [int]
587
- Convert a C :c:type :`int` representing a character to Python :class:`str`
587
+ Convert a C :c:expr :`int` representing a character to Python :class:`str`
588
588
object of length 1.
589
589
590
590
``d`` (:class: `float `) [double]
591
- Convert a C :c:type :`double` to a Python floating point number.
591
+ Convert a C :c:expr :`double` to a Python floating point number.
592
592
593
593
``f`` (:class: `float `) [float]
594
- Convert a C :c:type :`float` to a Python floating point number.
594
+ Convert a C :c:expr :`float` to a Python floating point number.
595
595
596
596
``D`` (:class: `complex `) [Py_complex \*]
597
597
Convert a C :c:type:`Py_complex` structure to a Python complex number.
@@ -614,7 +614,7 @@ Building values
614
614
615
615
``O&`` (object) [*converter*, *anything*]
616
616
Convert *anything* to a Python object through a *converter* function. The
617
- function is called with *anything* (which should be compatible with :c:type : `void* `)
617
+ function is called with *anything* (which should be compatible with :c:expr : `void* `)
618
618
as its argument and should return a "new" Python object, or ``NULL`` if an
619
619
error occurred.
620
620
0 commit comments