Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[dataclasses] Exception on__doc__ generation, when object signature cannot be fetched #103449

Closed
Assignees
sobolevn
Labels
stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@Eclips4

Description

@Eclips4

Reproducible on current main branch:

fromdataclassesimportdataclassfromtypingimportTypedDict@dataclassclassFoo(TypedDict):bar:int

Traceback:

Traceback (mostrecentcalllast):File"/home/eclips4/projects/test.py",line6,in<module>    @dataclass^^^^^^^^^File"/usr/local/lib/python3.12/dataclasses.py",line1237,indataclassreturnwrap(cls)^^^^^^^^^File"/usr/local/lib/python3.12/dataclasses.py",line1227,inwrapreturn_process_class(cls,init,repr,eq,order,unsafe_hash,^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/usr/local/lib/python3.12/dataclasses.py",line1113,in_process_classstr(inspect.signature(cls)).replace(' -> None',''))^^^^^^^^^^^^^^^^^^^^^^File"/usr/local/lib/python3.12/inspect.py",line3252,insignaturereturnSignature.from_callable(obj,follow_wrapped=follow_wrapped,^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/usr/local/lib/python3.12/inspect.py",line2996,infrom_callablereturn_signature_from_callable(obj,sigcls=cls,^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/usr/local/lib/python3.12/inspect.py",line2503,in_signature_from_callablesig=_get_signature_of(call)^^^^^^^^^^^^^^^^^^^^^^^File"/usr/local/lib/python3.12/inspect.py",line2556,in_signature_from_callableraiseValueError(ValueError:nosignaturefoundforbuiltintype<class'dict'>

However, this code works on 3.8 version (but of course we cannot instantiate aTest class)
Maybe we need to add a some check in sources ofdataclass.
Also, this error is not critical, so, feel free to "close as not planned" =)

Linked PRs

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp