]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-106310 - document the __signature__ attribute (GH-106311) (#111145)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 23 Oct 2023 15:49:12 +0000 (17:49 +0200)
committerGitHub <noreply@github.com>
Mon, 23 Oct 2023 15:49:12 +0000 (18:49 +0300)
Co-authored-by: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Doc/library/inspect.rst

index 23dde26ea3ecd7766a25df6be6f98e690d558962..9f0b965bb03f7a939f91b1e92b2c55b313026673 100644 (file)
@@ -640,6 +640,9 @@ function.
    Accepts a wide range of Python callables, from plain functions and classes to
    :func:`functools.partial` objects.
 
+   If the passed object has a ``__signature__`` attribute, this function
+   returns it without further computations.
+
    For objects defined in modules using stringized annotations
    (``from __future__ import annotations``), :func:`signature` will
    attempt to automatically un-stringize the annotations using
@@ -760,6 +763,8 @@ function.
          sig = MySignature.from_callable(min)
          assert isinstance(sig, MySignature)
 
+       Its behavior is otherwise identical to that of :func:`signature`.
+
        .. versionadded:: 3.5
 
        .. versionadded:: 3.10