diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2022-03-17 09:52:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-17 09:52:24 +0200 |
| commit | 15df8f8d89a0e563bdd15e4cd6734298736a5a1d (patch) | |
| tree | f47f546faa84d3ae5e91cb8ca06edb30f9fc8134 /Lib/typing.py | |
| parent | 4674fd4e938eb4a29ccd5b12c15455bd2a41c335 (diff) | |
| download | cpython-git-15df8f8d89a0e563bdd15e4cd6734298736a5a1d.tar.gz | |
bpo-46981: Remove typing._TypingEmpty (GH-31836)
* get_args(Tuple[()]) now returns () instead of ((),).
* Tuple[Unpack[Ts]][()] now returns the result equal to Tuple[()].
Diffstat (limited to 'Lib/typing.py')
| -rw-r--r-- | Lib/typing.py | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/Lib/typing.py b/Lib/typing.py index 6930f5ddac..e8613625c3 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -1220,7 +1220,6 @@ class _GenericAlias(_BaseGenericAlias, _root=True): if not isinstance(args, tuple): args = (args,) self.__args__ = tuple(... if a is _TypingEllipsis else - () if a is _TypingEmpty else a for a in args) self.__parameters__ = _collect_parameters(args) self._paramspec_tvars = _paramspec_tvars @@ -1503,8 +1502,6 @@ class _CallableType(_SpecialGenericAlias, _root=True): class _TupleType(_SpecialGenericAlias, _root=True): @_tp_cache def __getitem__(self, params): - if params == (): - return self.copy_with((_TypingEmpty,)) if not isinstance(params, tuple): params = (params,) if len(params) >= 2 and params[-1] is ...: @@ -1735,13 +1732,6 @@ class Generic: cls.__parameters__ = tuple(tvars) -class _TypingEmpty: - """Internal placeholder for () or []. Used by TupleMeta and CallableMeta - to allow empty list/tuple in specific places, without allowing them - to sneak in where prohibited. - """ - - class _TypingEllipsis: """Internal placeholder for ... (ellipsis).""" |
