bpo-46981: Remove typing._TypingEmpty by serhiy-storchaka · Pull Request #31836 · python/cpython (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice simplification! One thing I wonder about is whether this would break 3rd party frameworks that do runtime introspection of annotations? E.g. pydantic. Who can we ask?

Searching pydantic, it seems that get_args is rarely used. However, I will cc Samuel just to be sure. The last time we had a change in get_type_hints re Union, I sought his opinion too. Maybe this will help him figure things out if one of his tests breaks.

@samuelcolvin a summary of the change, for your info please:

typing.get_args(typing.Tuple[()]) now returns () instead of ((),).