Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
yay 3.7
  • Loading branch information
JelleZijlstra committed May 26, 2023
commit 43ac0c4b4ca1d8602e73f7e3d705d86b0a6c4912
10 changes: 5 additions & 5 deletions src/typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ def __subclasscheck__(cls, other):

__instancecheck__ = __subclasscheck__

def TypedDict(typename, fields=None, /, *, total=True, **kwargs):
def TypedDict(__typename, __fields=None, *, total=True, **kwargs):
"""A simple typed namespace. At runtime it is equivalent to a plain dict.

TypedDict creates a dictionary type that expects all of its
Expand Down Expand Up @@ -1036,8 +1036,8 @@ class point2D(TypedDict, total=False):
the total argument. True is the default, and makes all items defined in the
class body be required.
"""
if fields is None:
fields = kwargs
if __fields is None:
__fields = kwargs
elif kwargs:
raise TypeError("TypedDict takes either a dict or keyword arguments,"
" but not both")
Expand All @@ -1050,13 +1050,13 @@ class body be required.
stacklevel=2,
)

ns = {'__annotations__': dict(fields)}
ns = {'__annotations__': dict(__fields)}
module = _caller()
if module is not None:
# Setting correct module is necessary to make typed dict classes pickleable.
ns['__module__'] = module

td = _TypedDictMeta(typename, (), ns, total=total)
td = _TypedDictMeta(__typename, (), ns, total=total)
td.__orig_bases__ = (TypedDict,)
return td

Expand Down