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

typing.get_type_hints() works forCallable[[], None] from thetyping module, but notcollections.abc #91621

Closed
Labels
3.11only security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or error
@Zac-HD

Description

@Zac-HD

Bug report

typing.get_type_hints() works forCallable[[], None] from thetyping module, but notcollections.abc. This is the standard way to annotate a callable which takes no arguments, and the generic types fromtyping should behave identically to those incollections.abc.

importcollections.abcimporttypingdeff1(x:typing.Callable[[],None]):passdeff2(x:collections.abc.Callable[[],None]):passassert"x"intyping.get_type_hints(f1)typing.get_type_hints(f2)# Raises TypeError!

Your environment

CPython 3.11.0a7 (and I believe back to a3), found via CIfor Hypothesis, and reproduced in Ubuntu/WSL2 locally.
I'm skipping that test for now, and will re-enable when this is fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-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