@@ -971,7 +971,8 @@ def _get_typeddict_qualifiers(annotation_type):
971971 break
972972
973973 class _TypedDictMeta (type ):
974- def __new__ (cls , name , bases , ns , * , total = True , closed = None , extra_items = NoExtraItems ):
974+ def __new__ (cls , name , bases , ns , * , total = True , closed = None ,
975+ extra_items = NoExtraItems ):
975976 """Create new typed dict class object.
976977
977978 This method is called when TypedDict is subclassed,
@@ -1044,6 +1045,7 @@ def __new__(cls, name, bases, ns, *, total=True, closed=None, extra_items=NoExtr
10441045 "Child of a closed TypedDict must also be closed. This will "
10451046 "be an error in Python 3.14." ,
10461047 DeprecationWarning ,
1048+ stacklevel = 2 ,
10471049 )
10481050 else :
10491051 raise TypeError ("Child of a closed TypedDict must also be closed" )
@@ -1052,9 +1054,10 @@ def __new__(cls, name, bases, ns, *, total=True, closed=None, extra_items=NoExtr
10521054 extra_items_type = Never
10531055
10541056 # This was specified in an earlier version of PEP 728. Support
1055- # is retained for backwards compatibility, but only for Python 3.13
1056- # and lower.
1057- if closed and sys .version_info < (3 , 14 ) and "__extra_items__" in own_annotations :
1057+ # is retained for backwards compatibility, but only for Python
1058+ # 3.13 and lower.
1059+ if (closed and sys .version_info < (3 , 14 )
1060+ and "__extra_items__" in own_annotations ):
10581061 annotation_type = own_annotations .pop ("__extra_items__" )
10591062 qualifiers = set (_get_typeddict_qualifiers (annotation_type ))
10601063 if Required in qualifiers :
@@ -1208,7 +1211,8 @@ class Point2D(TypedDict):
12081211 # Setting correct module is necessary to make typed dict classes pickleable.
12091212 ns ['__module__' ] = module
12101213
1211- td = _TypedDictMeta (typename , (), ns , total = total , closed = closed , extra_items = extra_items )
1214+ td = _TypedDictMeta (typename , (), ns , total = total , closed = closed ,
1215+ extra_items = extra_items )
12121216 td .__orig_bases__ = (TypedDict ,)
12131217 return td
12141218
0 commit comments