Skip to content

Commit 135d5c5

Browse files
miss-islingtonGouvernathorAlexWaygood
authored
[3.11] gh-106310 - document the __signature__ attribute (GH-106311) (#111146)
Co-authored-by: Gouvernathor <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
1 parent f446df7 commit 135d5c5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Doc/library/inspect.rst

+5
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,9 @@ function.
619619
Accepts a wide range of Python callables, from plain functions and classes to
620620
:func:`functools.partial` objects.
621621

622+
If the passed object has a ``__signature__`` attribute, this function
623+
returns it without further computations.
624+
622625
For objects defined in modules using stringized annotations
623626
(``from __future__ import annotations``), :func:`signature` will
624627
attempt to automatically un-stringize the annotations using
@@ -738,6 +741,8 @@ function.
738741
sig = MySignature.from_callable(min)
739742
assert isinstance(sig, MySignature)
740743

744+
Its behavior is otherwise identical to that of :func:`signature`.
745+
741746
.. versionadded:: 3.5
742747

743748
.. versionadded:: 3.10

0 commit comments

Comments
 (0)