Skip to content

Commit dba5772

Browse files
committed
Add to non-generic TypedDict
1 parent 8cb2b0f commit dba5772

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Lib/test/test_typing.py

+3
Original file line numberDiff line numberDiff line change
@@ -7125,6 +7125,9 @@ class TD(TypedDict):
71257125
a = A(a = 1)
71267126
self.assertIs(type(a), dict)
71277127
self.assertEqual(a, {'a': 1})
7128+
7129+
def test_orig_bases(self):
7130+
self.assertEqual(ChildTotalMovie.__orig_bases__, (ParentNontotalMovie,))
71287131

71297132

71307133
class RequiredTests(BaseTestCase):

Lib/typing.py

+3
Original file line numberDiff line numberDiff line change
@@ -2994,6 +2994,9 @@ def __new__(cls, name, bases, ns, total=True):
29942994

29952995
tp_dict = type.__new__(_TypedDictMeta, name, (*generic_base, dict), ns)
29962996

2997+
if not hasattr(tp_dict, '__orig_bases__'):
2998+
tp_dict.__orig_bases__ = bases
2999+
29973000
annotations = {}
29983001
own_annotations = ns.get('__annotations__', {})
29993002
msg = "TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a type"

0 commit comments

Comments
 (0)