Skip to content

Commit b3c4bb3

Browse files
Aaron WieczorekAaron Wieczorek
authored andcommitted
fix: preserve specialization in generic TypedDict.update() plugin
1 parent 0cc21d9 commit b3c4bb3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

mypy/plugins/default.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,8 @@ def typed_dict_update_signature_callback(ctx: MethodSigContext) -> CallableType:
479479
arg_type = get_proper_type(signature.arg_types[0])
480480
if not isinstance(arg_type, TypedDictType):
481481
return signature
482-
arg_type = arg_type.as_anonymous()
483-
arg_type = arg_type.copy_modified(required_keys=set())
482+
anonymous_fallback = arg_type.as_anonymous().fallback
483+
arg_type = ctx.type.copy_modified(fallback=anonymous_fallback, required_keys=set())
484484
if ctx.args and ctx.args[0]:
485485
if signature.name in _TP_DICT_MUTATING_METHODS:
486486
# If we want to mutate this object in place, we need to set this flag,

0 commit comments

Comments
 (0)