Skip to content

Commit 6482bc9

Browse files
christianbundyDetachHead
authored andcommitted
Replace TypeVarDef with TypeVarType
Problem: While using the Pydantic plugin with bleeding-edge Mypy I realized that Pydantic is using a recently-removed type. Solution: Find two instances of `TypeVarDef` and rename to `TypeVarType`. See-also: python/mypy#9951
1 parent d7a8272 commit 6482bc9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pydantic/mypy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def add_construct_method(self, fields: List['PydanticModelField']) -> None:
352352
obj_type = ctx.api.named_type(f'{BUILTINS_NAME}.object')
353353
self_tvar_name = '_PydanticBaseModel' # Make sure it does not conflict with other names in the class
354354
tvar_fullname = ctx.cls.fullname + '.' + self_tvar_name
355-
tvd = TypeVarDef(self_tvar_name, tvar_fullname, -1, [], obj_type)
355+
tvd = TypeVarType(self_tvar_name, tvar_fullname, -1, [], obj_type)
356356
self_tvar_expr = TypeVarExpr(self_tvar_name, tvar_fullname, [], obj_type)
357357
ctx.cls.info.names[self_tvar_name] = SymbolTableNode(MDEF, self_tvar_expr)
358358

@@ -620,7 +620,7 @@ def add_method(
620620
args: List[Argument],
621621
return_type: Type,
622622
self_type: Optional[Type] = None,
623-
tvar_def: Optional[TypeVarDef] = None,
623+
tvar_def: Optional[TypeVarType] = None,
624624
is_classmethod: bool = False,
625625
is_new: bool = False,
626626
# is_staticmethod: bool = False,

0 commit comments

Comments
 (0)