gh-107298: Fix some references in the C API documentation (GH-108072)

This commit is contained in:
Serhiy Storchaka 2023-08-17 11:16:00 +03:00 committed by GitHub
parent 1344cfac43
commit f51f0466c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 20 additions and 20 deletions

View File

@ -1697,7 +1697,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
to a pointer, are valid C99 address constants.
However, the unary '&' operator applied to a non-static variable
like :c:func:`PyBaseObject_Type` is not required to produce an address
like :c:data:`PyBaseObject_Type` is not required to produce an address
constant. Compilers may support this (gcc does), MSVC does not.
Both compilers are strictly standard conforming in this particular
behavior.

View File

@ -242,7 +242,7 @@ 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.
We discuss the use of ``PyMODINIT_FUNC`` as a function return type later in this
We discuss the use of :c:macro:`PyMODINIT_FUNC` as a function return type later in this
sample.
The :exc:`!spam.error` exception can be raised in your extension module using a
@ -363,7 +363,7 @@ only non-\ ``static`` item defined in the module file::
return PyModule_Create(&spammodule);
}
Note that PyMODINIT_FUNC declares the function as ``PyObject *`` return type,
Note that :c:macro:`PyMODINIT_FUNC` declares the function as ``PyObject *`` return type,
declares any special linkage declarations required by the platform, and for C++
declares the function as ``extern "C"``.

View File

@ -746,8 +746,8 @@ Example on Linux x86-64::
At the beginning of the files, C extensions are built as built-in modules.
Extensions defined after the ``*shared*`` marker are built as dynamic libraries.
The :c:macro:`PyAPI_FUNC()`, :c:macro:`PyAPI_API()` and
:c:macro:`PyMODINIT_FUNC()` macros of :file:`Include/pyport.h` are defined
The :c:macro:`PyAPI_FUNC()`, :c:macro:`PyAPI_DATA()` and
:c:macro:`PyMODINIT_FUNC` macros of :file:`Include/pyport.h` are defined
differently depending if the ``Py_BUILD_CORE_MODULE`` macro is defined:
* Use ``Py_EXPORTED_SYMBOL`` if the ``Py_BUILD_CORE_MODULE`` is defined

View File

@ -1109,7 +1109,7 @@ code, none of the changes described here will affect you very much.
definition tables to simplify implementation of methods with no arguments or a
single untyped argument. Calling such methods is more efficient than calling a
corresponding method that uses :c:macro:`METH_VARARGS`. Also, the old
:c:macro:`METH_OLDARGS` style of writing C methods is now officially deprecated.
:c:macro:`!METH_OLDARGS` style of writing C methods is now officially deprecated.
* Two new wrapper functions, :c:func:`PyOS_snprintf` and :c:func:`PyOS_vsnprintf`
were added to provide cross-platform implementations for the relatively new

View File

@ -1886,7 +1886,7 @@ Changes to Python's build process and to the C API include:
(:file:`libpython2.3.so`) by supplying :option:`!--enable-shared` when running
Python's :program:`configure` script. (Contributed by Ondrej Palkovsky.)
* The :c:macro:`DL_EXPORT` and :c:macro:`DL_IMPORT` macros are now deprecated.
* The :c:macro:`!DL_EXPORT` and :c:macro:`!DL_IMPORT` macros are now deprecated.
Initialization functions for Python extension modules should now be declared
using the new macro :c:macro:`PyMODINIT_FUNC`, while the Python core will
generally use the :c:macro:`PyAPI_FUNC` and :c:macro:`PyAPI_DATA` macros.

View File

@ -1476,7 +1476,7 @@ Some of the changes to Python's build process and to the C API are:
:c:func:`PyArg_ParseTupleAndKeywords` but takes a :c:type:`va_list` instead of a
number of arguments. (Contributed by Greg Chapman.)
* A new method flag, :c:macro:`METH_COEXISTS`, allows a function defined in slots
* A new method flag, :c:macro:`METH_COEXIST`, allows a function defined in slots
to co-exist with a :c:type:`PyCFunction` having the same name. This can halve
the access time for a method such as :meth:`set.__contains__`. (Contributed by
Raymond Hettinger.)

View File

@ -3060,9 +3060,9 @@ Changes to Python's build process and to the C API include:
* Some macros were renamed in both 3.0 and 2.6 to make it clearer that
they are macros,
not functions. :c:macro:`Py_Size()` became :c:macro:`Py_SIZE()`,
:c:macro:`Py_Type()` became :c:macro:`Py_TYPE()`, and
:c:macro:`Py_Refcnt()` became :c:macro:`Py_REFCNT()`.
not functions. :c:macro:`!Py_Size()` became :c:macro:`Py_SIZE()`,
:c:macro:`!Py_Type()` became :c:macro:`Py_TYPE()`, and
:c:macro:`!Py_Refcnt()` became :c:macro:`Py_REFCNT()`.
The mixed-case macros are still available
in Python 2.6 for backward compatibility.
(:issue:`1629`)

View File

@ -2287,10 +2287,10 @@ object, and then get the ``void *`` pointer, which will usually point
to an array of pointers to the module's various API functions.
There is an existing data type already used for this,
:c:type:`PyCObject`, but it doesn't provide type safety. Evil code
:c:type:`!PyCObject`, but it doesn't provide type safety. Evil code
written in pure Python could cause a segmentation fault by taking a
:c:type:`PyCObject` from module A and somehow substituting it for the
:c:type:`PyCObject` in module B. Capsules know their own name,
:c:type:`!PyCObject` from module A and somehow substituting it for the
:c:type:`!PyCObject` in module B. Capsules know their own name,
and getting the pointer requires providing the name:
.. code-block:: c
@ -2310,10 +2310,10 @@ detect the mismatched name and return false. Refer to
:ref:`using-capsules` for more information on using these objects.
Python 2.7 now uses capsules internally to provide various
extension-module APIs, but the :c:func:`PyCObject_AsVoidPtr` was
extension-module APIs, but the :c:func:`!PyCObject_AsVoidPtr` was
modified to handle capsules, preserving compile-time compatibility
with the :c:type:`CObject` interface. Use of
:c:func:`PyCObject_AsVoidPtr` will signal a
with the :c:type:`!PyCObject` interface. Use of
:c:func:`!PyCObject_AsVoidPtr` will signal a
:exc:`PendingDeprecationWarning`, which is silent by default.
Implemented in Python 3.1 and backported to 2.7 by Larry Hastings;

View File

@ -875,7 +875,7 @@ to the C API.
* Renamed the boolean conversion C-level slot and method:
``nb_nonzero`` is now ``nb_bool``.
* Removed :c:macro:`METH_OLDARGS` and :c:macro:`WITH_CYCLE_GC` from the C API.
* Removed :c:macro:`!METH_OLDARGS` and :c:macro:`!WITH_CYCLE_GC` from the C API.
.. ======================================================================

View File

@ -510,7 +510,7 @@ Changes to Python's build process and to the C API include:
(Contributed by Mark Dickinson; :issue:`5914`.)
* Added :c:type:`PyCapsule` as a replacement for the :c:type:`PyCObject` API.
* Added :c:type:`PyCapsule` as a replacement for the :c:type:`!PyCObject` API.
The principal difference is that the new type has a well defined interface
for passing typing safety information and a less complicated signature
for calling a destructor. The old type had a problematic API and is now

View File

@ -2658,7 +2658,7 @@ require changes to your code:
* "t#" format has been removed: use "s#" or "s*" instead
* "w" and "w#" formats has been removed: use "w*" instead
* The :c:type:`PyCObject` type, deprecated in 3.1, has been removed. To wrap
* The :c:type:`!PyCObject` type, deprecated in 3.1, has been removed. To wrap
opaque C pointers in Python objects, the :c:type:`PyCapsule` API should be used
instead; the new type has a well-defined interface for passing typing safety
information and a less complicated signature for calling a destructor.