Skip to content

Commit 05b6153

Browse files
[3.12] gh-97908: CAPI docs: Remove repeated struct names from member docs (GH-100054) (#105057)
And add raw HTML fragments to keep old links working. (cherry picked from commit 1668b41) Co-authored-by: Petr Viktorin <encukou@gmail.com>
1 parent 0c51318 commit 05b6153

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

Doc/c-api/structures.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ Accessing attributes of extension types
395395
396396
The string should be static, no copy is made of it.
397397
398-
.. c:member:: Py_ssize_t PyMemberDef.offset
398+
.. c:member:: Py_ssize_t offset
399399
400400
The offset in bytes that the member is located on the type’s object struct.
401401
@@ -625,23 +625,23 @@ Defining Getters and Setters
625625
Structure to define property-like access for a type. See also description of
626626
the :c:member:`PyTypeObject.tp_getset` slot.
627627
628-
.. c:member:: const char* PyGetSetDef.name
628+
.. c:member:: const char* name
629629
630630
attribute name
631631
632-
.. c:member:: getter PyGetSetDef.get
632+
.. c:member:: getter get
633633
634634
C function to get the attribute.
635635
636-
.. c:member:: setter PyGetSetDef.set
636+
.. c:member:: setter set
637637
638638
Optional C function to set or delete the attribute, if omitted the attribute is readonly.
639639
640-
.. c:member:: const char* PyGetSetDef.doc
640+
.. c:member:: const char* doc
641641
642642
optional docstring
643643
644-
.. c:member:: void* PyGetSetDef.closure
644+
.. c:member:: void* closure
645645
646646
Optional function pointer, providing additional data for getter and setter.
647647

Doc/c-api/type.rst

+17-2
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,15 @@ The following functions and structs are used to create
349349
:c:member:`~PyTypeObject.tp_new` is deprecated and in Python 3.14+ it
350350
will be no longer allowed.
351351
352+
.. raw:: html
353+
354+
<!-- Keep old URL fragments working (see gh-97908) -->
355+
<span id='c.PyType_Spec.PyType_Spec.name'></span>
356+
<span id='c.PyType_Spec.PyType_Spec.basicsize'></span>
357+
<span id='c.PyType_Spec.PyType_Spec.itemsize'></span>
358+
<span id='c.PyType_Spec.PyType_Spec.flags'></span>
359+
<span id='c.PyType_Spec.PyType_Spec.slots'></span>
360+
352361
.. c:type:: PyType_Spec
353362
354363
Structure defining a type's behavior.
@@ -410,12 +419,18 @@ The following functions and structs are used to create
410419
411420
Each slot ID should be specified at most once.
412421
422+
.. raw:: html
423+
424+
<!-- Keep old URL fragments working (see gh-97908) -->
425+
<span id='c.PyType_Slot.PyType_Slot.slot'></span>
426+
<span id='c.PyType_Slot.PyType_Slot.pfunc'></span>
427+
413428
.. c:type:: PyType_Slot
414429
415430
Structure defining optional functionality of a type, containing a slot ID
416431
and a value pointer.
417432
418-
.. c:member:: int PyType_Slot.slot
433+
.. c:member:: int slot
419434
420435
A slot ID.
421436
@@ -459,7 +474,7 @@ The following functions and structs are used to create
459474
:c:member:`~PyBufferProcs.bf_releasebuffer` are now available
460475
under the limited API.
461476
462-
.. c:member:: void *PyType_Slot.pfunc
477+
.. c:member:: void *pfunc
463478
464479
The desired value of the slot. In most cases, this is a pointer
465480
to a function.

0 commit comments

Comments
 (0)