diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-10-30 10:03:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-30 10:03:20 (GMT) |
commit | 25fc088607c855060ed142296dc1bd0125fad1af (patch) | |
tree | 384af093a75c0d66a00da4b1d2b184e68de67211 /Doc/c-api/object.rst | |
parent | da6ce58dd5ac109485af45878fca6bfd265b43e9 (diff) | |
download | cpython-25fc088607c855060ed142296dc1bd0125fad1af.zip cpython-25fc088607c855060ed142296dc1bd0125fad1af.tar.gz cpython-25fc088607c855060ed142296dc1bd0125fad1af.tar.bz2 |
bpo-38600: Change the mark up of NULL in the C API documentation. (GH-16950)
Replace all *NULL* with ``NULL``.
Diffstat (limited to 'Doc/c-api/object.rst')
-rw-r--r-- | Doc/c-api/object.rst | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst index fd1e9c6..0b93064 100644 --- a/Doc/c-api/object.rst +++ b/Doc/c-api/object.rst @@ -53,14 +53,14 @@ Object Protocol .. c:function:: PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name) Retrieve an attribute named *attr_name* from object *o*. Returns the attribute - value on success, or *NULL* on failure. This is the equivalent of the Python + value on success, or ``NULL`` on failure. This is the equivalent of the Python expression ``o.attr_name``. .. c:function:: PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name) Retrieve an attribute named *attr_name* from object *o*. Returns the attribute - value on success, or *NULL* on failure. This is the equivalent of the Python + value on success, or ``NULL`` on failure. This is the equivalent of the Python expression ``o.attr_name``. @@ -81,7 +81,7 @@ Object Protocol return ``0`` on success. This is the equivalent of the Python statement ``o.attr_name = v``. - If *v* is *NULL*, the attribute is deleted, however this feature is + If *v* is ``NULL``, the attribute is deleted, however this feature is deprecated in favour of using :c:func:`PyObject_DelAttr`. @@ -92,7 +92,7 @@ Object Protocol return ``0`` on success. This is the equivalent of the Python statement ``o.attr_name = v``. - If *v* is *NULL*, the attribute is deleted, however this feature is + If *v* is ``NULL``, the attribute is deleted, however this feature is deprecated in favour of using :c:func:`PyObject_DelAttrString`. @@ -143,7 +143,7 @@ Object Protocol :const:`Py_NE`, :const:`Py_GT`, or :const:`Py_GE`, corresponding to ``<``, ``<=``, ``==``, ``!=``, ``>``, or ``>=`` respectively. This is the equivalent of the Python expression ``o1 op o2``, where ``op`` is the operator corresponding - to *opid*. Returns the value of the comparison on success, or *NULL* on failure. + to *opid*. Returns the value of the comparison on success, or ``NULL`` on failure. .. c:function:: int PyObject_RichCompareBool(PyObject *o1, PyObject *o2, int opid) @@ -165,7 +165,7 @@ Object Protocol .. index:: builtin: repr Compute a string representation of object *o*. Returns the string - representation on success, *NULL* on failure. This is the equivalent of the + representation on success, ``NULL`` on failure. This is the equivalent of the Python expression ``repr(o)``. Called by the :func:`repr` built-in function. .. versionchanged:: 3.4 @@ -188,7 +188,7 @@ Object Protocol .. c:function:: PyObject* PyObject_Str(PyObject *o) Compute a string representation of object *o*. Returns the string - representation on success, *NULL* on failure. This is the equivalent of the + representation on success, ``NULL`` on failure. This is the equivalent of the Python expression ``str(o)``. Called by the :func:`str` built-in function and, therefore, by the :func:`print` function. @@ -200,7 +200,7 @@ Object Protocol .. index:: builtin: bytes - Compute a bytes representation of object *o*. *NULL* is returned on + Compute a bytes representation of object *o*. ``NULL`` is returned on failure and a bytes object on success. This is equivalent to the Python expression ``bytes(o)``, when *o* is not an integer. Unlike ``bytes(o)``, a TypeError is raised when *o* is an integer instead of a zero-initialized @@ -259,7 +259,7 @@ Object Protocol most efficient way to call a callable Python object without any argument. Return the result of the call on success, or raise an exception and return - *NULL* on failure. + ``NULL`` on failure. .. versionadded:: 3.9 @@ -270,7 +270,7 @@ Object Protocol *arg* and no keyword arguments. Return the result of the call on success, or raise an exception and return - *NULL* on failure. + ``NULL`` on failure. .. versionadded:: 3.9 @@ -280,11 +280,11 @@ Object Protocol Call a callable Python object *callable*, with arguments given by the tuple *args*, and named arguments given by the dictionary *kwargs*. - *args* must not be *NULL*, use an empty tuple if no arguments are needed. - If no named arguments are needed, *kwargs* can be *NULL*. + *args* must not be ``NULL``, use an empty tuple if no arguments are needed. + If no named arguments are needed, *kwargs* can be ``NULL``. Return the result of the call on success, or raise an exception and return - *NULL* on failure. + ``NULL`` on failure. This is the equivalent of the Python expression: ``callable(*args, **kwargs)``. @@ -293,10 +293,10 @@ Object Protocol .. c:function:: PyObject* PyObject_CallObject(PyObject *callable, PyObject *args) Call a callable Python object *callable*, with arguments given by the - tuple *args*. If no arguments are needed, then *args* can be *NULL*. + tuple *args*. If no arguments are needed, then *args* can be ``NULL``. Return the result of the call on success, or raise an exception and return - *NULL* on failure. + ``NULL`` on failure. This is the equivalent of the Python expression: ``callable(*args)``. @@ -305,10 +305,10 @@ Object Protocol Call a callable Python object *callable*, with a variable number of C arguments. The C arguments are described using a :c:func:`Py_BuildValue` style format - string. The format can be *NULL*, indicating that no arguments are provided. + string. The format can be ``NULL``, indicating that no arguments are provided. Return the result of the call on success, or raise an exception and return - *NULL* on failure. + ``NULL`` on failure. This is the equivalent of the Python expression: ``callable(*args)``. @@ -325,10 +325,10 @@ Object Protocol arguments. The C arguments are described by a :c:func:`Py_BuildValue` format string that should produce a tuple. - The format can be *NULL*, indicating that no arguments are provided. + The format can be ``NULL``, indicating that no arguments are provided. Return the result of the call on success, or raise an exception and return - *NULL* on failure. + ``NULL`` on failure. This is the equivalent of the Python expression: ``obj.name(arg1, arg2, ...)``. @@ -344,10 +344,10 @@ Object Protocol Call a callable Python object *callable*, with a variable number of :c:type:`PyObject\*` arguments. The arguments are provided as a variable number - of parameters followed by *NULL*. + of parameters followed by ``NULL``. Return the result of the call on success, or raise an exception and return - *NULL* on failure. + ``NULL`` on failure. This is the equivalent of the Python expression: ``callable(arg1, arg2, ...)``. @@ -358,10 +358,10 @@ Object Protocol Calls a method of the Python object *obj*, where the name of the method is given as a Python string object in *name*. It is called with a variable number of :c:type:`PyObject\*` arguments. The arguments are provided as a variable number - of parameters followed by *NULL*. + of parameters followed by ``NULL``. Return the result of the call on success, or raise an exception and return - *NULL* on failure. + ``NULL`` on failure. .. c:function:: PyObject* _PyObject_CallMethodNoArgs(PyObject *obj, PyObject *name) @@ -370,7 +370,7 @@ Object Protocol where the name of the method is given as a Python string object in *name*. Return the result of the call on success, or raise an exception and return - *NULL* on failure. + ``NULL`` on failure. .. versionadded:: 3.9 @@ -382,7 +382,7 @@ Object Protocol *name*. Return the result of the call on success, or raise an exception and return - *NULL* on failure. + ``NULL`` on failure. .. versionadded:: 3.9 @@ -408,7 +408,7 @@ Object Protocol and all keys must be unique. Return the result of the call on success, or raise an exception and return - *NULL* on failure. + ``NULL`` on failure. This uses the vectorcall protocol if the callable supports it; otherwise, the arguments are converted to use @@ -450,7 +450,7 @@ Object Protocol .. c:function:: PyObject* _PyObject_FastCallDict(PyObject *callable, PyObject *const *args, size_t nargsf, PyObject *kwdict) Same as :c:func:`_PyObject_Vectorcall` except that the keyword arguments - are passed as a dictionary in *kwdict*. This may be *NULL* if there + are passed as a dictionary in *kwdict*. This may be ``NULL`` if there are no keyword arguments. For callables supporting :c:data:`vectorcall <PyTypeObject.tp_vectorcall_offset>`, @@ -483,7 +483,7 @@ Object Protocol *args* vector as arguments. Return the result of the call on success, or raise an exception and return - *NULL* on failure. + ``NULL`` on failure. .. versionadded:: 3.9 @@ -525,8 +525,8 @@ Object Protocol .. index:: builtin: type - When *o* is non-*NULL*, returns a type object corresponding to the object type - of object *o*. On failure, raises :exc:`SystemError` and returns *NULL*. This + When *o* is non-``NULL``, returns a type object corresponding to the object type + of object *o*. On failure, raises :exc:`SystemError` and returns ``NULL``. This is equivalent to the Python expression ``type(o)``. This function increments the reference count of the return value. There's really no reason to use this function instead of the common expression ``o->ob_type``, which returns a @@ -537,7 +537,7 @@ Object Protocol .. c:function:: int PyObject_TypeCheck(PyObject *o, PyTypeObject *type) Return true if the object *o* is of type *type* or a subtype of *type*. Both - parameters must be non-*NULL*. + parameters must be non-``NULL``. .. c:function:: Py_ssize_t PyObject_Size(PyObject *o) @@ -562,7 +562,7 @@ Object Protocol .. c:function:: PyObject* PyObject_GetItem(PyObject *o, PyObject *key) - Return element of *o* corresponding to the object *key* or *NULL* on failure. + Return element of *o* corresponding to the object *key* or ``NULL`` on failure. This is the equivalent of the Python expression ``o[key]``. @@ -582,15 +582,15 @@ Object Protocol .. c:function:: PyObject* PyObject_Dir(PyObject *o) This is equivalent to the Python expression ``dir(o)``, returning a (possibly - empty) list of strings appropriate for the object argument, or *NULL* if there - was an error. If the argument is *NULL*, this is like the Python ``dir()``, + empty) list of strings appropriate for the object argument, or ``NULL`` if there + was an error. If the argument is ``NULL``, this is like the Python ``dir()``, returning the names of the current locals; in this case, if no execution frame - is active then *NULL* is returned but :c:func:`PyErr_Occurred` will return false. + is active then ``NULL`` is returned but :c:func:`PyErr_Occurred` will return false. .. c:function:: PyObject* PyObject_GetIter(PyObject *o) This is equivalent to the Python expression ``iter(o)``. It returns a new iterator for the object argument, or the object itself if the object is already - an iterator. Raises :exc:`TypeError` and returns *NULL* if the object cannot be + an iterator. Raises :exc:`TypeError` and returns ``NULL`` if the object cannot be iterated. |