]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-101100: Fix most Sphinx nitpicks in `inspect.rst` (GH-112662) (#112666)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 3 Dec 2023 17:39:26 +0000 (18:39 +0100)
committerGitHub <noreply@github.com>
Sun, 3 Dec 2023 17:39:26 +0000 (17:39 +0000)
gh-101100: Fix most Sphinx nitpicks in `inspect.rst` (GH-112662)
(cherry picked from commit 45650d1c479a8b0370f126d821718dd3c502f333)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Doc/conf.py
Doc/library/inspect.rst
Doc/reference/datamodel.rst
Doc/whatsnew/2.6.rst
Doc/whatsnew/2.7.rst

index 98b84db964bf5ee76ee0ed93ba9ce1874b0cf553..6bc8090f62f3d25e2b749d3f0350a53b08a9ff83 100644 (file)
@@ -157,6 +157,9 @@ nitpick_ignore = [
     ('envvar', 'USER'),
     ('envvar', 'USERNAME'),
     ('envvar', 'USERPROFILE'),
+    # Deprecated function that was never documented:
+    ('py:func', 'getargspec'),
+    ('py:func', 'inspect.getargspec'),
 ]
 
 # Temporary undocumented names.
index 6971b20315849d80f524753b5eceb854e738d416..bf5e6ea3d7f3711c7eca33fa689fcd5074ed1713 100644 (file)
@@ -273,7 +273,7 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
 
       :func:`getmembers` will only return class attributes defined in the
       metaclass when the argument is a class and those attributes have been
-      listed in the metaclass' custom :meth:`__dir__`.
+      listed in the metaclass' custom :meth:`~object.__dir__`.
 
 
 .. function:: getmembers_static(object[, predicate])
@@ -487,12 +487,13 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
    has a :meth:`~object.__get__` method but not a :meth:`~object.__set__`
    method, but beyond that the set of attributes varies.  A
    :attr:`~definition.__name__` attribute is usually
-   sensible, and :attr:`__doc__` often is.
+   sensible, and :attr:`!__doc__` often is.
 
    Methods implemented via descriptors that also pass one of the other tests
    return ``False`` from the :func:`ismethoddescriptor` test, simply because the
    other tests promise more -- you can, e.g., count on having the
-   :attr:`__func__` attribute (etc) when an object passes :func:`ismethod`.
+   :ref:`__func__ <instance-methods>` attribute (etc) when an object passes
+   :func:`ismethod`.
 
 
 .. function:: isdatadescriptor(object)
@@ -503,7 +504,7 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
    Examples are properties (defined in Python), getsets, and members.  The
    latter two are defined in C and there are more specific tests available for
    those types, which is robust across Python implementations.  Typically, data
-   descriptors will also have :attr:`~definition.__name__` and :attr:`__doc__` attributes
+   descriptors will also have :attr:`~definition.__name__` and :attr:`!__doc__` attributes
    (properties, getsets, and members have both of these attributes), but this is
    not guaranteed.
 
@@ -1423,7 +1424,8 @@ Fetching attributes statically
 
 Both :func:`getattr` and :func:`hasattr` can trigger code execution when
 fetching or checking for the existence of attributes. Descriptors, like
-properties, will be invoked and :meth:`__getattr__` and :meth:`__getattribute__`
+properties, will be invoked and :meth:`~object.__getattr__` and
+:meth:`~object.__getattribute__`
 may be called.
 
 For cases where you want passive introspection, like documentation tools, this
@@ -1433,7 +1435,8 @@ but avoids executing code when it fetches attributes.
 .. function:: getattr_static(obj, attr, default=None)
 
    Retrieve attributes without triggering dynamic lookup via the
-   descriptor protocol, :meth:`__getattr__` or :meth:`__getattribute__`.
+   descriptor protocol, :meth:`~object.__getattr__`
+   or :meth:`~object.__getattribute__`.
 
    Note: this function may not be able to retrieve all attributes
    that getattr can fetch (like dynamically created attributes)
index b8ad4c7b7a94ad8a44db033f3ded55eee36b4945..2650885130591c0ca2f42659daf205dde1c5b5c7 100644 (file)
@@ -634,6 +634,8 @@ code object; see the description of internal types below. The
 module.
 
 
+.. _instance-methods:
+
 Instance methods
 ^^^^^^^^^^^^^^^^
 
index 2b7ef2cd4fe4a9d857d2876576ee2b4bf3f9487e..7d8987e100f9eef09525cac8e089e5621a979013 100644 (file)
@@ -1677,8 +1677,9 @@ Some smaller changes made to the core Python language are:
   (:issue:`1591665`)
 
 * Instance method objects have new attributes for the object and function
-  comprising the method; the new synonym for :attr:`im_self` is
-  :attr:`__self__`, and :attr:`im_func` is also available as :attr:`__func__`.
+  comprising the method; the new synonym for :attr:`!im_self` is
+  :ref:`__self__ <instance-methods>`, and :attr:`!im_func` is also available as
+  :ref:`__func__ <instance-methods>`.
   The old names are still supported in Python 2.6, but are gone in 3.0.
 
 * An obscure change: when you use the :func:`locals` function inside a
index 6c0d31c47d5b4b6149ab5c498a9a40d7cb553bff..92de3e4d8af98240ad4c829bfe9ec704045c2d4e 100644 (file)
@@ -860,7 +860,8 @@ Some smaller changes made to the core Python language are:
 
 * When using ``@classmethod`` and ``@staticmethod`` to wrap
   methods as class or static methods, the wrapper object now
-  exposes the wrapped function as their :attr:`__func__` attribute.
+  exposes the wrapped function as their :ref:`__func__ <instance-methods>`
+  attribute.
   (Contributed by Amaury Forgeot d'Arc, after a suggestion by
   George Sakkis; :issue:`5982`.)