Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 603c5d5

Browse files
[3.11] gh-107091: Fix some uses of :c:type: role (GH-107138) (GH-107313)
(cherry picked from commit 6d5b6e7) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent 35aa6b8 commit 603c5d5

File tree

9 files changed

+28
-22
lines changed

9 files changed

+28
-22
lines changed

Doc/c-api/tuple.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ Tuple Objects
111111
raises :exc:`MemoryError` or :exc:`SystemError`.
112112
113113
114+
.. _struct-sequence-objects:
115+
114116
Struct Sequence Objects
115117
-----------------------
116118

Doc/c-api/typeobj.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ Quick Reference
161161
162162
.. [#cols] Columns:
163163
164-
**"O"**: set on :c:type:`PyBaseObject_Type`
164+
**"O"**: set on :c:data:`PyBaseObject_Type`
165165
166-
**"T"**: set on :c:type:`PyType_Type`
166+
**"T"**: set on :c:data:`PyType_Type`
167167
168168
**"D"**: default (if slot is set to ``NULL``)
169169
@@ -567,8 +567,8 @@ PyTypeObject Slots
567567

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

573573
.. c:member:: const char* PyTypeObject.tp_name
574574
@@ -962,7 +962,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
962962

963963
**Default:**
964964

965-
:c:type:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`.
965+
:c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`.
966966

967967

968968
.. c:member:: setattrofunc PyTypeObject.tp_setattro
@@ -988,7 +988,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
988988

989989
**Default:**
990990

991-
:c:type:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`.
991+
:c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`.
992992

993993

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

1033-
:c:type:`PyBaseObject_Type` uses
1033+
:c:data:`PyBaseObject_Type` uses
10341034
``Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE``.
10351035

10361036
**Bit Masks:**
@@ -1492,7 +1492,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
14921492

14931493
**Default:**
14941494

1495-
:c:type:`PyBaseObject_Type` provides a :attr:`tp_richcompare`
1495+
:c:data:`PyBaseObject_Type` provides a :attr:`tp_richcompare`
14961496
implementation, which may be inherited. However, if only
14971497
:attr:`tp_hash` is defined, not even the inherited function is used
14981498
and instances of the type will not be able to participate in any
@@ -1814,7 +1814,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
18141814
:c:func:`PyType_GenericAlloc`, to force a standard heap
18151815
allocation strategy.
18161816

1817-
For static subtypes, :c:type:`PyBaseObject_Type` uses
1817+
For static subtypes, :c:data:`PyBaseObject_Type` uses
18181818
:c:func:`PyType_GenericAlloc`. That is the recommended value
18191819
for all statically defined types.
18201820

@@ -1877,7 +1877,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
18771877
match :c:func:`PyType_GenericAlloc` and the value of the
18781878
:c:macro:`Py_TPFLAGS_HAVE_GC` flag bit.
18791879

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

18821882

18831883
.. c:member:: inquiry PyTypeObject.tp_is_gc

Doc/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@
103103
('c:type', 'uintmax_t'),
104104
('c:type', 'va_list'),
105105
('c:type', 'wchar_t'),
106+
('c:struct', 'in6_addr'),
107+
('c:struct', 'in_addr'),
108+
('c:struct', 'stat'),
109+
('c:struct', 'statvfs'),
106110
# Standard C macros
107111
('c:macro', 'LLONG_MAX'),
108112
('c:macro', 'LLONG_MIN'),

Doc/library/os.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,13 +2243,13 @@ features:
22432243
.. function:: major(device, /)
22442244

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

22482248

22492249
.. function:: minor(device, /)
22502250

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

22542254

22552255
.. function:: makedev(major, minor, /)
@@ -2743,7 +2743,7 @@ features:
27432743
.. class:: stat_result
27442744

27452745
Object whose attributes correspond roughly to the members of the
2746-
:c:type:`stat` structure. It is used for the result of :func:`os.stat`,
2746+
:c:struct:`stat` structure. It is used for the result of :func:`os.stat`,
27472747
:func:`os.fstat` and :func:`os.lstat`.
27482748

27492749
Attributes:
@@ -2906,12 +2906,12 @@ features:
29062906
See the ``IO_REPARSE_TAG_*`` constants in the :mod:`stat` module.
29072907

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

29122912
For backward compatibility, a :class:`stat_result` instance is also
29132913
accessible as a tuple of at least 10 integers giving the most important (and
2914-
portable) members of the :c:type:`stat` structure, in the order
2914+
portable) members of the :c:struct:`stat` structure, in the order
29152915
:attr:`st_mode`, :attr:`st_ino`, :attr:`st_dev`, :attr:`st_nlink`,
29162916
:attr:`st_uid`, :attr:`st_gid`, :attr:`st_size`, :attr:`st_atime`,
29172917
:attr:`st_mtime`, :attr:`st_ctime`. More items may be added at the end by
@@ -2944,7 +2944,7 @@ features:
29442944

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

Doc/whatsnew/2.4.rst

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ Some smaller changes made to the core Python language are:
564564

565565
(See :issue:`4617`.)
566566

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

Doc/whatsnew/3.3.rst

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

Doc/whatsnew/3.7.rst

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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)