Brandt Bucher <[email protected]> added the comment:
It looks like the issue is that _TypedDictMeta only respects "total" as a
keyword argument to __new__, but the TypedDict function passes it along by
setting __total__ in the generated namespace instead.
This fixes it:
diff --git a/Lib/typing.py b/Lib/typing.py
index 46c54c4..bb0696b 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -2050,7 +2050,7 @@ class body be required.
except (AttributeError, ValueError):
pass
- return _TypedDictMeta(typename, (), ns)
+ return _TypedDictMeta(typename, (), ns, total=total)
_TypedDict = type.__new__(_TypedDictMeta, 'TypedDict', (), {})
TypedDict.__mro_entries__ = lambda bases: (_TypedDict,)
----------
nosy: +brandtbucher
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42592>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com