diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2023-07-23 10:27:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-23 10:27:05 (GMT) |
commit | 08a228da05a7aec937b65eea21f4091fa3c6b5cf (patch) | |
tree | 970db16e88a29906c6b6c118de86033040aacf74 /Doc/extending | |
parent | c65592c4d6d7552fb6284442906a96a6874cb266 (diff) | |
download | cpython-08a228da05a7aec937b65eea21f4091fa3c6b5cf.zip cpython-08a228da05a7aec937b65eea21f4091fa3c6b5cf.tar.gz cpython-08a228da05a7aec937b65eea21f4091fa3c6b5cf.tar.bz2 |
gh-107091: Fix the use of some C domain roles (#107092)
Diffstat (limited to 'Doc/extending')
-rw-r--r-- | Doc/extending/extending.rst | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst index 0163ba1..0c5da49 100644 --- a/Doc/extending/extending.rst +++ b/Doc/extending/extending.rst @@ -237,10 +237,10 @@ Note that the Python name for the exception object is :exc:`spam.error`. The being :exc:`Exception` (unless another class is passed in instead of ``NULL``), described in :ref:`bltin-exceptions`. -Note also that the :c:data:`SpamError` variable retains a reference to the newly +Note also that the :c:data:`!SpamError` variable retains a reference to the newly created exception class; this is intentional! Since the exception could be removed from the module by external code, an owned reference to the class is -needed to ensure that it will not be discarded, causing :c:data:`SpamError` to +needed to ensure that it will not be discarded, causing :c:data:`!SpamError` to become a dangling pointer. Should it become a dangling pointer, C code which raises the exception could cause a core dump or other unintended side effects. @@ -281,9 +281,9 @@ statement:: It returns ``NULL`` (the error indicator for functions returning object pointers) if an error is detected in the argument list, relying on the exception set by :c:func:`PyArg_ParseTuple`. Otherwise the string value of the argument has been -copied to the local variable :c:data:`command`. This is a pointer assignment and +copied to the local variable :c:data:`!command`. This is a pointer assignment and you are not supposed to modify the string to which it points (so in Standard C, -the variable :c:data:`command` should properly be declared as ``const char +the variable :c:data:`!command` should properly be declared as ``const char *command``). The next statement is a call to the Unix function :c:func:`system`, passing it @@ -291,7 +291,7 @@ the string we just got from :c:func:`PyArg_ParseTuple`:: sts = system(command); -Our :func:`spam.system` function must return the value of :c:data:`sts` as a +Our :func:`!spam.system` function must return the value of :c:data:`!sts` as a Python object. This is done using the function :c:func:`PyLong_FromLong`. :: return PyLong_FromLong(sts); |