Skip to content

Commit 6a5aab0

Browse files
miss-islingtonGouvernathorAlexWaygood
authored
[3.12] gh-106310 - document the __signature__ attribute (GH-106311) (#111145)
Co-authored-by: Gouvernathor <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
1 parent d4d947d commit 6a5aab0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Doc/library/inspect.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,9 @@ function.
640640
Accepts a wide range of Python callables, from plain functions and classes to
641641
:func:`functools.partial` objects.
642642

643+
If the passed object has a ``__signature__`` attribute, this function
644+
returns it without further computations.
645+
643646
For objects defined in modules using stringized annotations
644647
(``from __future__ import annotations``), :func:`signature` will
645648
attempt to automatically un-stringize the annotations using
@@ -760,6 +763,8 @@ function.
760763
sig = MySignature.from_callable(min)
761764
assert isinstance(sig, MySignature)
762765

766+
Its behavior is otherwise identical to that of :func:`signature`.
767+
763768
.. versionadded:: 3.5
764769

765770
.. versionadded:: 3.10

0 commit comments

Comments
 (0)