[issue46643] typing.Annotated cannot wrap typing.ParamSpec args/kwargs

Gregory Beauregard report at bugs.python.org
Wed Feb 9 22:19:47 EST 2022


Gregory Beauregard <greg at greg.red> added the comment:

I wrote a PR that fixes the underlying issue here, but I'm leaving it as a draft while the discussion plays out. I think the stuff currently in the patch should be okay regardless of the discussion decision, because the underlying issue is that P.args and P.kwargs didn't pass typing._type_check, which is needed for reasons unrelated to Annotated (such as if they were stringified and had get_type_hints called on them).

If the result of the discussion is that we need to start supporting limitations on where Annotated is used, I'll add another PR that introduces support for this pattern in whatever locations that are decided it shouldn't be allowed.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46643>
_______________________________________


More information about the Python-bugs-list mailing list