]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-115937: Remove implementation details from inspect.signature() docs (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 29 Feb 2024 09:54:48 +0000 (10:54 +0100)
committerGitHub <noreply@github.com>
Thu, 29 Feb 2024 09:54:48 +0000 (01:54 -0800)
gh-115937: Remove implementation details from inspect.signature() docs (GH-116086)
(cherry picked from commit fb2e17b642fc3089e4f98e4bf6b09dd362e6b27d)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Doc/library/inspect.rst

index 2ddd5beebd94a4bcff8ccea69680fbe03bff0f02..9048e6a405cd248042bccfced2049e0c876b653f 100644 (file)
@@ -634,9 +634,6 @@ 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
@@ -671,6 +668,13 @@ function.
       Python.  For example, in CPython, some built-in functions defined in
       C provide no metadata about their arguments.
 
+   .. impl-detail::
+
+      If the passed object has a :attr:`!__signature__` attribute,
+      we may use it to create the signature.
+      The exact semantics are an implementation detail and are subject to
+      unannounced changes. Consult the source code for current semantics.
+
 
 .. class:: Signature(parameters=None, *, return_annotation=Signature.empty)