Skip to content
Merged
Show file tree
Hide file tree
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
Modify docs
  • Loading branch information
97littleleaf11 committed Feb 9, 2022
commit eea168f06ae240e5e4f1716e56489ff24fdd1fba
2 changes: 1 addition & 1 deletion Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ These are not used in annotations. They are building blocks for declaring types.

.. deprecated-removed:: 3.11 3.13
Comment thread
97littleleaf11 marked this conversation as resolved.
The keyword-argument syntax is deprecated in 3.11 and will be removed
in 3.13. It may also be unsupported by third-party type-checking tools.
in 3.13. It may also be unsupported by static type checkers.

By default, all keys must be present in a ``TypedDict``. It is possible to
override this by specifying totality.
Expand Down
3 changes: 2 additions & 1 deletion Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4316,7 +4316,8 @@ def test_basics_keywords_syntax(self):
self.assertEqual(Emp.__total__, True)

def test_typeddict_special_keyword_names(self):
TD = TypedDict("TD", {'cls': type, 'self': object, 'typename': str, '_typename': int, 'fields': list, '_fields': dict})
with self.assertWarns(DeprecationWarning):
TD = TypedDict("TD", cls=type, self=object, typename=str, _typename=int, fields=list, _fields=dict)
self.assertEqual(TD.__name__, 'TD')
self.assertEqual(TD.__annotations__, {'cls': type, 'self': object, 'typename': str, '_typename': int, 'fields': list, '_fields': dict})
a = TD(cls=str, self=42, typename='foo', _typename=53, fields=[('bar', tuple)], _fields={'baz', set})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Deprecate kwargs-based syntax for :class:`typing.TypedDict` definitions.
It was unsupported by type checkers. Patch by Jingchen Ye.
It had confusing semantics when specifying totality, and was largely unused.
Patch by Jingchen Ye.
Comment thread
97littleleaf11 marked this conversation as resolved.
Outdated