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 n_rosenstein
Recipients AlexWaygood, BTaskaya, JelleZijlstra, eric.smith, gvanrossum, joperez, kj, levkivskyi, lukasz.langa, miss-islington, n_rosenstein, sobolevn
Date 2022-01-25.20:19:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1643141955.51.0.919266968011.issue41370@roundup.psfhosted.org>
In-reply-to
Content
It was not my intention to sound passive agressive. Thanks for providing the context around the time PEP 585 was discussed.

Frankly, I believe I have explained the problem quite well. But I would like to propose a solution.

I can't judge in what circumstance a `str` would end up in `typing._GenericAlias.__args__` since `typing._GenericAlias.__getitem__()` converts strings to `typing.ForwardRef` using `_type_check()` immediately.

Assuming this is indeed a case to be taken into account, I would propose that `typing.get_type_hint()` implements special treatment for `types.GenericAlias` such that strings in `__args__` are treated as forward references, and keep the old behaviour for `typing._GenericAlias`. Do you see any problems with that?

Of course this would break cases that have come to strictly expect strings in PEP 585 generic `__args__` since the release of Python 3.10 to stay strings, although I cannot come up with an example or think of a usecase myself.
History
Date User Action Args
2022-01-25 20:19:15n_rosensteinsetrecipients: + n_rosenstein, gvanrossum, eric.smith, lukasz.langa, levkivskyi, JelleZijlstra, miss-islington, BTaskaya, sobolevn, joperez, kj, AlexWaygood
2022-01-25 20:19:15n_rosensteinsetmessageid: <1643141955.51.0.919266968011.issue41370@roundup.psfhosted.org>
2022-01-25 20:19:15n_rosensteinlinkissue41370 messages
2022-01-25 20:19:15n_rosensteincreate