Skip to content

Commit cb11842

Browse files
Docs: Resolve Sphinx warnings in dis.rst (#108476)
- Link to the code objects reference - Suppress link to deliberately undocumented builtins.__build_class__ - Suppress links for example methods
1 parent 2b7bff0 commit cb11842

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

@@ -862,7 +862,7 @@ iterations of the loop.
862862

863863
.. opcode:: LOAD_BUILD_CLASS
864864

865-
Pushes :func:`builtins.__build_class__` onto the stack. It is later called
865+
Pushes :func:`!builtins.__build_class__` onto the stack. It is later called
866866
to construct a class.
867867

868868

@@ -920,14 +920,14 @@ iterations of the loop.
920920
.. opcode:: STORE_NAME (namei)
921921

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

926926

927927
.. opcode:: DELETE_NAME (namei)
928928

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

932932

933933
.. opcode:: UNPACK_SEQUENCE (count)
@@ -966,7 +966,8 @@ iterations of the loop.
966966
value = STACK.pop()
967967
obj.name = value
968968

969-
where *namei* is the index of name in :attr:`co_names`.
969+
where *namei* is the index of name in :attr:`!co_names` of the
970+
:ref:`code object <code-objects>`.
970971

971972
.. opcode:: DELETE_ATTR (namei)
972973

@@ -975,7 +976,8 @@ iterations of the loop.
975976
obj = STACK.pop()
976977
del obj.name
977978

978-
where *namei* is the index of name into :attr:`co_names`.
979+
where *namei* is the index of name into :attr:`!co_names` of the
980+
:ref:`code object <code-objects>`.
979981

980982

981983
.. 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
@@ -57,7 +57,6 @@ Doc/library/dbm.rst
5757
Doc/library/decimal.rst
5858
Doc/library/devmode.rst
5959
Doc/library/difflib.rst
60-
Doc/library/dis.rst
6160
Doc/library/doctest.rst
6261
Doc/library/email.charset.rst
6362
Doc/library/email.compat32-message.rst

0 commit comments

Comments
 (0)