@@ -27,7 +27,7 @@ the definition of all other Python objects.
27
27
object. In a normal "release" build, it contains only the object's
28
28
reference count and a pointer to the corresponding type object.
29
29
Nothing is actually declared to be a :c:type: `PyObject `, but every pointer
30
- to a Python object can be cast to a :c:type : `PyObject* `. Access to the
30
+ to a Python object can be cast to a :c:expr : `PyObject* `. Access to the
31
31
members must be done by using the macros :c:macro: `Py_REFCNT ` and
32
32
:c:macro: `Py_TYPE `.
33
33
@@ -184,7 +184,7 @@ Implementing functions and methods
184
184
.. c :type :: PyCFunction
185
185
186
186
Type of the functions used to implement most Python callables in C.
187
- Functions of this type take two :c:type : `PyObject* ` parameters and return
187
+ Functions of this type take two :c:expr : `PyObject* ` parameters and return
188
188
one such value. If the return value is ``NULL ``, an exception shall have
189
189
been set. If not ``NULL ``, the return value is interpreted as the return
190
190
value of the function as exposed in Python. The function must return a new
@@ -263,10 +263,10 @@ Implementing functions and methods
263
263
+------------------+---------------+-------------------------------+
264
264
265
265
The :attr: `ml_meth ` is a C function pointer. The functions may be of different
266
- types, but they always return :c:type : `PyObject* `. If the function is not of
266
+ types, but they always return :c:expr : `PyObject* `. If the function is not of
267
267
the :c:type: `PyCFunction `, the compiler will require a cast in the method table.
268
268
Even though :c:type: `PyCFunction ` defines the first parameter as
269
- :c:type : `PyObject* `, it is common that the method implementation uses the
269
+ :c:expr : `PyObject* `, it is common that the method implementation uses the
270
270
specific C type of the *self * object.
271
271
272
272
The :attr: `ml_flags ` field is a bitfield which can include the following flags.
@@ -278,7 +278,7 @@ There are these calling conventions:
278
278
.. data :: METH_VARARGS
279
279
280
280
This is the typical calling convention, where the methods have the type
281
- :c:type: `PyCFunction `. The function expects two :c:type : `PyObject* ` values.
281
+ :c:type: `PyCFunction `. The function expects two :c:expr : `PyObject* ` values.
282
282
The first one is the *self * object for methods; for module functions, it is
283
283
the module object. The second parameter (often called *args *) is a tuple
284
284
object representing all arguments. This parameter is typically processed
@@ -299,7 +299,7 @@ There are these calling conventions:
299
299
Fast calling convention supporting only positional arguments.
300
300
The methods have the type :c:type:`_PyCFunctionFast`.
301
301
The first parameter is *self*, the second parameter is a C array
302
- of :c:type :`PyObject*` values indicating the arguments and the third
302
+ of :c:expr :`PyObject*` values indicating the arguments and the third
303
303
parameter is the number of arguments (the length of the array).
304
304
305
305
.. versionadded:: 3.7
@@ -315,7 +315,7 @@ There are these calling conventions:
315
315
with methods of type :c:type:`_PyCFunctionFastWithKeywords`.
316
316
Keyword arguments are passed the same way as in the
317
317
:ref:`vectorcall protocol <vectorcall>`:
318
- there is an additional fourth :c:type :`PyObject*` parameter
318
+ there is an additional fourth :c:expr :`PyObject*` parameter
319
319
which is a tuple representing the names of the keyword arguments
320
320
(which are guaranteed to be strings)
321
321
or possibly ``NULL`` if there are no keywords. The values of the keyword
@@ -354,7 +354,7 @@ There are these calling conventions:
354
354
Methods with a single object argument can be listed with the :const :`METH_O`
355
355
flag, instead of invoking :c:func:`PyArg_ParseTuple` with a ``"O"`` argument.
356
356
They have the type :c:type:`PyCFunction`, with the *self* parameter, and a
357
- :c:type :`PyObject*` parameter representing the single argument.
357
+ :c:expr :`PyObject*` parameter representing the single argument.
358
358
359
359
360
360
These two constants are not used to indicate the calling convention but the
@@ -522,15 +522,15 @@ Accessing attributes of extension types
522
522
| | | getter and setter |
523
523
+-------------+------------------+-----------------------------------+
524
524
525
- The ``get `` function takes one :c:type : `PyObject* ` parameter (the
525
+ The ``get `` function takes one :c:expr : `PyObject* ` parameter (the
526
526
instance) and a function pointer (the associated ``closure ``)::
527
527
528
528
typedef PyObject *(*getter)(PyObject *, void *);
529
529
530
530
It should return a new reference on success or ``NULL `` with a set exception
531
531
on failure.
532
532
533
- ``set `` functions take two :c:type : `PyObject* ` parameters (the instance and
533
+ ``set `` functions take two :c:expr : `PyObject* ` parameters (the instance and
534
534
the value to be set) and a function pointer (the associated ``closure ``)::
535
535
536
536
typedef int (*setter)(PyObject *, PyObject *, void *);
0 commit comments