diff options
Diffstat (limited to 'Doc/c-api/structures.rst')
-rw-r--r-- | Doc/c-api/structures.rst | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index b0a1938..1035277 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -113,8 +113,8 @@ Implementing functions and methods Type of the functions used to implement most Python callables in C. Functions of this type take two :c:type:`PyObject\*` parameters and return - one such value. If the return value is *NULL*, an exception shall have - been set. If not *NULL*, the return value is interpreted as the return + one such value. If the return value is ``NULL``, an exception shall have + been set. If not ``NULL``, the return value is interpreted as the return value of the function as exposed in Python. The function must return a new reference. @@ -186,7 +186,7 @@ also keyword arguments. So there are a total of 6 calling conventions: Methods with these flags must be of type :c:type:`PyCFunctionWithKeywords`. The function expects three parameters: *self*, *args*, *kwargs* where - *kwargs* is a dictionary of all the keyword arguments or possibly *NULL* + *kwargs* is a dictionary of all the keyword arguments or possibly ``NULL`` if there are no keyword arguments. The parameters are typically processed using :c:func:`PyArg_ParseTupleAndKeywords`. @@ -212,7 +212,7 @@ also keyword arguments. So there are a total of 6 calling conventions: there is an additional fourth :c:type:`PyObject\*` parameter which is a tuple representing the names of the keyword arguments (which are guaranteed to be strings) - or possibly *NULL* if there are no keywords. The values of the keyword + or possibly ``NULL`` if there are no keywords. The values of the keyword arguments are stored in the *args* array, after the positional arguments. This is not part of the :ref:`limited API <stable>`. @@ -226,7 +226,7 @@ also keyword arguments. So there are a total of 6 calling conventions: they are listed with the :const:`METH_NOARGS` flag. They need to be of type :c:type:`PyCFunction`. The first parameter is typically named *self* and will hold a reference to the module or object instance. In all cases the second - parameter will be *NULL*. + parameter will be ``NULL``. .. data:: METH_O @@ -257,7 +257,7 @@ method. .. index:: builtin: staticmethod - The method will be passed *NULL* as the first parameter rather than an + The method will be passed ``NULL`` as the first parameter rather than an instance of the type. This is used to create *static methods*, similar to what is created when using the :func:`staticmethod` built-in function. @@ -334,7 +334,7 @@ Accessing attributes of extension types =============== ================== :c:macro:`T_OBJECT` and :c:macro:`T_OBJECT_EX` differ in that - :c:macro:`T_OBJECT` returns ``None`` if the member is *NULL* and + :c:macro:`T_OBJECT` returns ``None`` if the member is ``NULL`` and :c:macro:`T_OBJECT_EX` raises an :exc:`AttributeError`. Try to use :c:macro:`T_OBJECT_EX` over :c:macro:`T_OBJECT` because :c:macro:`T_OBJECT_EX` handles use of the :keyword:`del` statement on that attribute more correctly @@ -344,7 +344,7 @@ Accessing attributes of extension types read-only access. Using :c:macro:`T_STRING` for :attr:`type` implies :c:macro:`READONLY`. :c:macro:`T_STRING` data is interpreted as UTF-8. Only :c:macro:`T_OBJECT` and :c:macro:`T_OBJECT_EX` - members can be deleted. (They are set to *NULL*). + members can be deleted. (They are set to ``NULL``). .. _pymemberdef-offsets: @@ -388,7 +388,7 @@ Accessing attributes of extension types typedef PyObject *(*getter)(PyObject *, void *); - It should return a new reference on success or *NULL* with a set exception + It should return a new reference on success or ``NULL`` with a set exception on failure. ``set`` functions take two :c:type:`PyObject\*` parameters (the instance and @@ -396,5 +396,5 @@ Accessing attributes of extension types typedef int (*setter)(PyObject *, PyObject *, void *); - In case the attribute should be deleted the second parameter is *NULL*. + In case the attribute should be deleted the second parameter is ``NULL``. Should return ``0`` on success or ``-1`` with a set exception on failure. |