Skip to content

Commit a0f5599

Browse files
authoredOct 4, 2022
pythongh-93738: Documentation C syntax (Use c:struct) (python#97772)
Use `c:struct`
1 parent fa59bda commit a0f5599

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed
 

‎Doc/c-api/import.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ Importing Modules
243243
UTF-8 encoded string instead of a Unicode object.
244244
245245
246-
.. c:type:: struct _frozen
246+
.. c:struct:: _frozen
247247
248248
.. index:: single: freeze utility
249249
@@ -265,7 +265,7 @@ Importing Modules
265265
266266
.. c:var:: const struct _frozen* PyImport_FrozenModules
267267
268-
This pointer is initialized to point to an array of :c:type:`struct _frozen`
268+
This pointer is initialized to point to an array of :c:struct:`_frozen`
269269
records, terminated by one whose members are all ``NULL`` or zero. When a frozen
270270
module is imported, it is searched in this table. Third-party code could play
271271
tricks with this to provide a dynamically created collection of frozen modules.
@@ -281,7 +281,7 @@ Importing Modules
281281
:c:func:`Py_Initialize`.
282282
283283
284-
.. c:type:: struct _inittab
284+
.. c:struct:: _inittab
285285
286286
Structure describing a single entry in the list of built-in modules. Each of
287287
these structures gives the name and initialization function for a module built

‎Doc/c-api/veryhigh.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ the same library that the Python runtime is using.
8282
.. c:function:: int PyRun_SimpleString(const char *command)
8383
8484
This is a simplified interface to :c:func:`PyRun_SimpleStringFlags` below,
85-
leaving the :c:type:`PyCompilerFlags`\* argument set to ``NULL``.
85+
leaving the :c:struct:`PyCompilerFlags`\* argument set to ``NULL``.
8686
8787
8888
.. c:function:: int PyRun_SimpleStringFlags(const char *command, PyCompilerFlags *flags)
@@ -338,7 +338,7 @@ the same library that the Python runtime is using.
338338
interpreter loop.
339339
340340
341-
.. c:type:: struct PyCompilerFlags
341+
.. c:struct:: PyCompilerFlags
342342
343343
This is the structure used to hold compiler flags. In cases where code is only
344344
being compiled, it is passed as ``int flags``, and in cases where code is being

‎Doc/library/ctypes.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ An extended example which also demonstrates the use of pointers accesses the
10881088

10891089
Quoting the docs for that value:
10901090

1091-
This pointer is initialized to point to an array of :c:type:`struct _frozen`
1091+
This pointer is initialized to point to an array of :c:struct:`_frozen`
10921092
records, terminated by one whose members are all ``NULL`` or zero. When a frozen
10931093
module is imported, it is searched in this table. Third-party code could play
10941094
tricks with this to provide a dynamically created collection of frozen modules.
@@ -1107,7 +1107,7 @@ size, we show only how this table can be read with :mod:`ctypes`::
11071107
...
11081108
>>>
11091109

1110-
We have defined the :c:type:`struct _frozen` data type, so we can get the pointer
1110+
We have defined the :c:struct:`_frozen` data type, so we can get the pointer
11111111
to the table::
11121112

11131113
>>> FrozenTable = POINTER(struct_frozen)

‎Doc/library/socket.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ The :mod:`socket` module also offers various network-related services:
10591059
Convert an IPv4 address from dotted-quad string format (for example,
10601060
'123.45.67.89') to 32-bit packed binary format, as a bytes object four characters in
10611061
length. This is useful when conversing with a program that uses the standard C
1062-
library and needs objects of type :c:type:`struct in_addr`, which is the C type
1062+
library and needs objects of type :c:struct:`in_addr`, which is the C type
10631063
for the 32-bit packed binary this function returns.
10641064

10651065
:func:`inet_aton` also accepts strings with less than three dots; see the
@@ -1078,7 +1078,7 @@ The :mod:`socket` module also offers various network-related services:
10781078
Convert a 32-bit packed IPv4 address (a :term:`bytes-like object` four
10791079
bytes in length) to its standard dotted-quad string representation (for example,
10801080
'123.45.67.89'). This is useful when conversing with a program that uses the
1081-
standard C library and needs objects of type :c:type:`struct in_addr`, which
1081+
standard C library and needs objects of type :c:struct:`in_addr`, which
10821082
is the C type for the 32-bit packed binary data this function takes as an
10831083
argument.
10841084

@@ -1095,8 +1095,8 @@ The :mod:`socket` module also offers various network-related services:
10951095

10961096
Convert an IP address from its family-specific string format to a packed,
10971097
binary format. :func:`inet_pton` is useful when a library or network protocol
1098-
calls for an object of type :c:type:`struct in_addr` (similar to
1099-
:func:`inet_aton`) or :c:type:`struct in6_addr`.
1098+
calls for an object of type :c:struct:`in_addr` (similar to
1099+
:func:`inet_aton`) or :c:struct:`in6_addr`.
11001100

11011101
Supported values for *address_family* are currently :const:`AF_INET` and
11021102
:const:`AF_INET6`. If the IP address string *ip_string* is invalid,
@@ -1116,8 +1116,8 @@ The :mod:`socket` module also offers various network-related services:
11161116
bytes) to its standard, family-specific string representation (for
11171117
example, ``'7.10.0.5'`` or ``'5aef:2b::8'``).
11181118
:func:`inet_ntop` is useful when a library or network protocol returns an
1119-
object of type :c:type:`struct in_addr` (similar to :func:`inet_ntoa`) or
1120-
:c:type:`struct in6_addr`.
1119+
object of type :c:struct:`in_addr` (similar to :func:`inet_ntoa`) or
1120+
:c:struct:`in6_addr`.
11211121

11221122
Supported values for *address_family* are currently :const:`AF_INET` and
11231123
:const:`AF_INET6`. If the bytes object *packed_ip* is not the correct

‎Doc/whatsnew/3.11.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1880,7 +1880,7 @@ Porting to Python 3.11
18801880
fields of the result from the exception instance (the ``value`` field).
18811881
(Contributed by Irit Katriel in :issue:`45711`.)
18821882

1883-
* :c:type:`_frozen` has a new ``is_package`` field to indicate whether
1883+
* :c:struct:`_frozen` has a new ``is_package`` field to indicate whether
18841884
or not the frozen module is a package. Previously, a negative value
18851885
in the ``size`` field was the indicator. Now only non-negative values
18861886
be used for ``size``.

‎Doc/whatsnew/3.8.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ Changes in the Python API
20152015
Changes in the C API
20162016
--------------------
20172017

2018-
* The :c:type:`PyCompilerFlags` structure got a new *cf_feature_version*
2018+
* The :c:struct:`PyCompilerFlags` structure got a new *cf_feature_version*
20192019
field. It should be initialized to ``PY_MINOR_VERSION``. The field is ignored
20202020
by default, and is used if and only if ``PyCF_ONLY_AST`` flag is set in
20212021
*cf_flags*.

0 commit comments

Comments
 (0)
Please sign in to comment.