Skip to content

Commit 311fd96

Browse files
[3.12] Docs: Resolve Sphinx warnings in dis.rst (GH-108476) (#108546)
Docs: Resolve Sphinx warnings in dis.rst (GH-108476) - Link to the code objects reference - Suppress link to deliberately undocumented builtins.__build_class__ - Suppress links for example methods (cherry picked from commit cb11842) Co-authored-by: Erlend E. Aasland <[email protected]>
1 parent 32d48ed commit 311fd96

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

Doc/library/dis.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ interpreter.
4343
adaptive bytecode can be shown by passing ``adaptive=True``.
4444

4545

46-
Example: Given the function :func:`myfunc`::
46+
Example: Given the function :func:`!myfunc`::
4747

4848
def myfunc(alist):
4949
return len(alist)
5050

5151
the following command can be used to display the disassembly of
52-
:func:`myfunc`:
52+
:func:`!myfunc`:
5353

5454
.. doctest::
5555

@@ -793,7 +793,7 @@ iterations of the loop.
793793

794794
.. opcode:: LOAD_BUILD_CLASS
795795

796-
Pushes :func:`builtins.__build_class__` onto the stack. It is later called
796+
Pushes :func:`!builtins.__build_class__` onto the stack. It is later called
797797
to construct a class.
798798

799799

@@ -851,14 +851,14 @@ iterations of the loop.
851851
.. opcode:: STORE_NAME (namei)
852852

853853
Implements ``name = STACK.pop()``. *namei* is the index of *name* in the attribute
854-
:attr:`co_names` of the code object. The compiler tries to use
855-
:opcode:`STORE_FAST` or :opcode:`STORE_GLOBAL` if possible.
854+
:attr:`!co_names` of the :ref:`code object <code-objects>`.
855+
The compiler tries to use :opcode:`STORE_FAST` or :opcode:`STORE_GLOBAL` if possible.
856856

857857

858858
.. opcode:: DELETE_NAME (namei)
859859

860-
Implements ``del name``, where *namei* is the index into :attr:`co_names`
861-
attribute of the code object.
860+
Implements ``del name``, where *namei* is the index into :attr:`!co_names`
861+
attribute of the :ref:`code object <code-objects>`.
862862

863863

864864
.. opcode:: UNPACK_SEQUENCE (count)
@@ -897,7 +897,8 @@ iterations of the loop.
897897
value = STACK.pop()
898898
obj.name = value
899899

900-
where *namei* is the index of name in :attr:`co_names`.
900+
where *namei* is the index of name in :attr:`!co_names` of the
901+
:ref:`code object <code-objects>`.
901902

902903
.. opcode:: DELETE_ATTR (namei)
903904

@@ -906,7 +907,8 @@ iterations of the loop.
906907
obj = STACK.pop()
907908
del obj.name
908909

909-
where *namei* is the index of name into :attr:`co_names`.
910+
where *namei* is the index of name into :attr:`!co_names` of the
911+
:ref:`code object <code-objects>`.
910912

911913

912914
.. opcode:: STORE_GLOBAL (namei)

Doc/reference/datamodel.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,12 +1039,14 @@ A few types used internally by the interpreter are exposed to the user. Their
10391039
definitions may change with future versions of the interpreter, but they are
10401040
mentioned here for completeness.
10411041

1042-
.. index:: bytecode, object; code, code object
10431042

1043+
.. _code-objects:
10441044

10451045
Code objects
10461046
^^^^^^^^^^^^
10471047

1048+
.. index:: bytecode, object; code, code object
1049+
10481050
Code objects represent *byte-compiled* executable Python code, or :term:`bytecode`.
10491051
The difference between a code object and a function object is that the function
10501052
object contains an explicit reference to the function's globals (the module in

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ Doc/library/dbm.rst
6464
Doc/library/decimal.rst
6565
Doc/library/devmode.rst
6666
Doc/library/difflib.rst
67-
Doc/library/dis.rst
6867
Doc/library/doctest.rst
6968
Doc/library/email.charset.rst
7069
Doc/library/email.compat32-message.rst

0 commit comments

Comments
 (0)