This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Zac Hatfield-Dodds
Recipients Zac Hatfield-Dodds
Date 2021-01-23.06:24:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1611383063.08.0.672499153283.issue43006@roundup.psfhosted.org>
In-reply-to
Content
Consider the following snippet, which passes on Python 3.9 and earlier:


    import inspect

    def f(x: int = None):
        pass

    print(inspect.signature(constructor))
    assert inspect.signature(constructor).parameters["a"].annotation == int


But under Python 3.10 (alpha 4), the annotation is instead read as Optional[int].  This is correct for typing.get_type_hints(), but *not* for inspect.signature().

I therefore suspect that this is an accidental side-effect from support for PEP-563 deferred evaluation of annotations.
History
Date User Action Args
2021-01-23 06:24:23Zac Hatfield-Doddssetrecipients: + Zac Hatfield-Dodds
2021-01-23 06:24:23Zac Hatfield-Doddssetmessageid: <1611383063.08.0.672499153283.issue43006@roundup.psfhosted.org>
2021-01-23 06:24:22Zac Hatfield-Doddslinkissue43006 messages
2021-01-23 06:24:22Zac Hatfield-Doddscreate