Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 921c653

Browse files
authored
Annotate TypedDict as _SpecialForm rather than object. (#12985)
* Annotate TypedDict as _SpecialForm rather than object. Let's see if this works... * Get typing_extensions.TypedDict as well, try to fix tests. * Import typing_extensions.TypedDict, delete _SpecialForm.__getitem__. * Back out deletion of _SpecialForm.__getitem__.
1 parent 4addb8d commit 921c653

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

stdlib/@tests/stubtest_allowlists/common.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ typing_extensions\.ParamSpec.*
464464
typing(_extensions)?\.Generic
465465
typing\.Protocol
466466
typing(_extensions)?\._TypedDict
467+
typing(_extensions)?\.TypedDict
467468
typing._Final
468469
typing._Final.__init_subclass__
469470

stdlib/typing.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,7 @@ Tuple: _SpecialForm
213213
Final: _SpecialForm
214214

215215
Literal: _SpecialForm
216-
# TypedDict is a (non-subscriptable) special form.
217-
TypedDict: object
216+
TypedDict: _SpecialForm
218217

219218
if sys.version_info >= (3, 11):
220219
Self: _SpecialForm

stdlib/typing_extensions.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ from typing import ( # noqa: Y022,Y037,Y038,Y039
5858
TextIO as TextIO,
5959
Tuple as Tuple,
6060
Type as Type,
61+
TypedDict as TypedDict,
6162
Union as Union,
6263
ValuesView as ValuesView,
6364
_Alias,
@@ -255,9 +256,6 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
255256
# supposedly incompatible definitions of `__ior__` and `__or__`:
256257
def __ior__(self, value: Self, /) -> Self: ... # type: ignore[misc]
257258

258-
# TypedDict is a (non-subscriptable) special form.
259-
TypedDict: object
260-
261259
OrderedDict = _Alias()
262260

263261
def get_type_hints(

0 commit comments

Comments
 (0)