From 071e3f5f4685470f55dab7fc474e9f89a8e49fb9 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Fri, 17 May 2024 18:49:27 -0400 Subject: [PATCH] stubtest: changes for py313 Technically it feels like we should be able to put the new dunders on `type` or something, but that wasn't enough to make false positives go away. But also we might not want to do that because it only applies to pure Python types --- mypy/stubtest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mypy/stubtest.py b/mypy/stubtest.py index dd43c472d67f..d78b71715159 100644 --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -634,6 +634,10 @@ def strip_prefix(s: str, prefix: str) -> str: if strip_prefix(stub_arg.variable.name, "__") == runtime_arg.name: return + nonspecific_names = {"object", "args"} + if runtime_arg.name in nonspecific_names: + return + def names_approx_match(a: str, b: str) -> bool: a = a.strip("_") b = b.strip("_") @@ -1455,6 +1459,8 @@ def verify_typealias( "__getattr__", # resulting behaviour might be typed explicitly "__setattr__", # defining this on a class can cause worse type checking "__vectorcalloffset__", # undocumented implementation detail of the vectorcall protocol + "__firstlineno__", + "__static_attributes__", # isinstance/issubclass hooks that type-checkers don't usually care about "__instancecheck__", "__subclasshook__",