mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
gh-128184: Fix display of signatures with ForwardRefs (#130815)
Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
parent
80e6d3ec49
commit
1d251b8339
5 changed files with 46 additions and 2 deletions
|
@ -1163,7 +1163,10 @@ def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen,
|
|||
try:
|
||||
# In some cases fetching a signature is not possible.
|
||||
# But, we surely should not fail in this case.
|
||||
text_sig = str(inspect.signature(cls)).replace(' -> None', '')
|
||||
text_sig = str(inspect.signature(
|
||||
cls,
|
||||
annotation_format=annotationlib.Format.FORWARDREF,
|
||||
)).replace(' -> None', '')
|
||||
except (TypeError, ValueError):
|
||||
text_sig = ''
|
||||
cls.__doc__ = (cls.__name__ + text_sig)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue