Skip to content

Commit 6d5b6e7

Browse files
gh-107091: Fix some uses of :c:type: role (GH-107138)
1 parent af61cb9 commit 6d5b6e7

File tree

9 files changed

+28
-22
lines changed

9 files changed

+28
-22
lines changed

Doc/c-api/tuple.rst

+2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ Tuple Objects
114114
raises :exc:`MemoryError` or :exc:`SystemError`.
115115
116116
117+
.. _struct-sequence-objects:
118+
117119
Struct Sequence Objects
118120
-----------------------
119121

Doc/c-api/typeobj.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ Quick Reference
163163
164164
.. [#cols] Columns:
165165
166-
**"O"**: set on :c:type:`PyBaseObject_Type`
166+
**"O"**: set on :c:data:`PyBaseObject_Type`
167167
168-
**"T"**: set on :c:type:`PyType_Type`
168+
**"T"**: set on :c:data:`PyType_Type`
169169
170170
**"D"**: default (if slot is set to ``NULL``)
171171
@@ -569,8 +569,8 @@ PyTypeObject Slots
569569

570570
Each slot has a section describing inheritance. If :c:func:`PyType_Ready`
571571
may set a value when the field is set to ``NULL`` then there will also be
572-
a "Default" section. (Note that many fields set on :c:type:`PyBaseObject_Type`
573-
and :c:type:`PyType_Type` effectively act as defaults.)
572+
a "Default" section. (Note that many fields set on :c:data:`PyBaseObject_Type`
573+
and :c:data:`PyType_Type` effectively act as defaults.)
574574

575575
.. c:member:: const char* PyTypeObject.tp_name
576576
@@ -964,7 +964,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
964964

965965
**Default:**
966966

967-
:c:type:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`.
967+
:c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`.
968968

969969

970970
.. c:member:: setattrofunc PyTypeObject.tp_setattro
@@ -990,7 +990,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
990990

991991
**Default:**
992992

993-
:c:type:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`.
993+
:c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`.
994994

995995

996996
.. c:member:: PyBufferProcs* PyTypeObject.tp_as_buffer
@@ -1031,7 +1031,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
10311031
10321032
**Default:**
10331033

1034-
:c:type:`PyBaseObject_Type` uses
1034+
:c:data:`PyBaseObject_Type` uses
10351035
``Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE``.
10361036

10371037
**Bit Masks:**
@@ -1556,7 +1556,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
15561556

15571557
**Default:**
15581558

1559-
:c:type:`PyBaseObject_Type` provides a :attr:`tp_richcompare`
1559+
:c:data:`PyBaseObject_Type` provides a :attr:`tp_richcompare`
15601560
implementation, which may be inherited. However, if only
15611561
:attr:`tp_hash` is defined, not even the inherited function is used
15621562
and instances of the type will not be able to participate in any
@@ -1878,7 +1878,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
18781878
:c:func:`PyType_GenericAlloc`, to force a standard heap
18791879
allocation strategy.
18801880

1881-
For static subtypes, :c:type:`PyBaseObject_Type` uses
1881+
For static subtypes, :c:data:`PyBaseObject_Type` uses
18821882
:c:func:`PyType_GenericAlloc`. That is the recommended value
18831883
for all statically defined types.
18841884

@@ -1941,7 +1941,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
19411941
match :c:func:`PyType_GenericAlloc` and the value of the
19421942
:c:macro:`Py_TPFLAGS_HAVE_GC` flag bit.
19431943

1944-
For static subtypes, :c:type:`PyBaseObject_Type` uses PyObject_Del.
1944+
For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:`PyObject_Del`.
19451945

19461946

19471947
.. c:member:: inquiry PyTypeObject.tp_is_gc

Doc/conf.py

+4
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@
108108
('c:type', 'uintmax_t'),
109109
('c:type', 'va_list'),
110110
('c:type', 'wchar_t'),
111+
('c:struct', 'in6_addr'),
112+
('c:struct', 'in_addr'),
113+
('c:struct', 'stat'),
114+
('c:struct', 'statvfs'),
111115
# Standard C macros
112116
('c:macro', 'LLONG_MAX'),
113117
('c:macro', 'LLONG_MIN'),

Doc/library/os.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -2420,13 +2420,13 @@ features:
24202420
.. function:: major(device, /)
24212421

24222422
Extract the device major number from a raw device number (usually the
2423-
:attr:`st_dev` or :attr:`st_rdev` field from :c:type:`stat`).
2423+
:attr:`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`).
24242424

24252425

24262426
.. function:: minor(device, /)
24272427

24282428
Extract the device minor number from a raw device number (usually the
2429-
:attr:`st_dev` or :attr:`st_rdev` field from :c:type:`stat`).
2429+
:attr:`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`).
24302430

24312431

24322432
.. function:: makedev(major, minor, /)
@@ -2937,7 +2937,7 @@ features:
29372937
.. class:: stat_result
29382938

29392939
Object whose attributes correspond roughly to the members of the
2940-
:c:type:`stat` structure. It is used for the result of :func:`os.stat`,
2940+
:c:struct:`stat` structure. It is used for the result of :func:`os.stat`,
29412941
:func:`os.fstat` and :func:`os.lstat`.
29422942

29432943
Attributes:
@@ -3117,12 +3117,12 @@ features:
31173117
See the ``IO_REPARSE_TAG_*`` constants in the :mod:`stat` module.
31183118

31193119
The standard module :mod:`stat` defines functions and constants that are
3120-
useful for extracting information from a :c:type:`stat` structure. (On
3120+
useful for extracting information from a :c:struct:`stat` structure. (On
31213121
Windows, some items are filled with dummy values.)
31223122

31233123
For backward compatibility, a :class:`stat_result` instance is also
31243124
accessible as a tuple of at least 10 integers giving the most important (and
3125-
portable) members of the :c:type:`stat` structure, in the order
3125+
portable) members of the :c:struct:`stat` structure, in the order
31263126
:attr:`st_mode`, :attr:`st_ino`, :attr:`st_dev`, :attr:`st_nlink`,
31273127
:attr:`st_uid`, :attr:`st_gid`, :attr:`st_size`, :attr:`st_atime`,
31283128
:attr:`st_mtime`, :attr:`st_ctime`. More items may be added at the end by
@@ -3174,7 +3174,7 @@ features:
31743174

31753175
Perform a :c:func:`statvfs` system call on the given path. The return value is
31763176
an object whose attributes describe the filesystem on the given path, and
3177-
correspond to the members of the :c:type:`statvfs` structure, namely:
3177+
correspond to the members of the :c:struct:`statvfs` structure, namely:
31783178
:attr:`f_bsize`, :attr:`f_frsize`, :attr:`f_blocks`, :attr:`f_bfree`,
31793179
:attr:`f_bavail`, :attr:`f_files`, :attr:`f_ffree`, :attr:`f_favail`,
31803180
:attr:`f_flag`, :attr:`f_namemax`, :attr:`f_fsid`.

Doc/whatsnew/2.4.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ Some of the changes to Python's build process and to the C API are:
14911491
though that processor architecture doesn't call that register "the TSC
14921492
register". (Contributed by Jeremy Hylton.)
14931493

1494-
* The :c:type:`tracebackobject` type has been renamed to
1494+
* The :c:type:`!tracebackobject` type has been renamed to
14951495
:c:type:`PyTracebackObject`.
14961496

14971497
.. ======================================================================

Doc/whatsnew/3.2.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ Some smaller changes made to the core Python language are:
566566

567567
(See :issue:`4617`.)
568568

569-
* The internal :c:type:`structsequence` tool now creates subclasses of tuple.
569+
* :ref:`Struct sequence types <struct-sequence-objects>` are now subclasses of tuple.
570570
This means that C structures like those returned by :func:`os.stat`,
571571
:func:`time.gmtime`, and :data:`sys.version_info` now work like a
572572
:term:`named tuple` and now work with functions and methods that

Doc/whatsnew/3.3.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2195,7 +2195,7 @@ Changes to Python's build process and to the C API include:
21952195
* :c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`
21962196
* :c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`,
21972197
:c:macro:`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`
2198-
* :c:macro:`PyUnicode_KIND` with :c:type:`PyUnicode_Kind` enum:
2198+
* :c:macro:`PyUnicode_KIND` with :c:enum:`PyUnicode_Kind` enum:
21992199
:c:data:`PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`,
22002200
:c:data:`PyUnicode_2BYTE_KIND`, :c:data:`PyUnicode_4BYTE_KIND`
22012201
* :c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:`PyUnicode_WRITE`

Doc/whatsnew/3.7.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,7 @@ module imports.
16771677
The fields :c:member:`!name` and :c:member:`!doc` of structures
16781678
:c:type:`PyMemberDef`, :c:type:`PyGetSetDef`,
16791679
:c:type:`PyStructSequence_Field`, :c:type:`PyStructSequence_Desc`,
1680-
and :c:type:`wrapperbase` are now of type ``const char *`` rather of
1680+
and :c:struct:`wrapperbase` are now of type ``const char *`` rather of
16811681
``char *``. (Contributed by Serhiy Storchaka in :issue:`28761`.)
16821682

16831683
The result of :c:func:`PyUnicode_AsUTF8AndSize` and :c:func:`PyUnicode_AsUTF8`

Misc/NEWS.d/3.10.0a7.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ a non-Python signal handler.
215215
.. nonce: VouZjn
216216
.. section: Core and Builtins
217217
218-
Add ``__match_args__`` to :c:type:`structsequence` based classes. Patch by
219-
Pablo Galindo.
218+
Add ``__match_args__`` to :ref:`struct sequence objects <struct-sequence-objects>`.
219+
Patch by Pablo Galindo.
220220

221221
..
222222

0 commit comments

Comments
 (0)