Skip to content

Commit

Permalink
stubtest: changes for py313 (#17261)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hauntsaninja committed May 18, 2024
1 parent 828c0be commit 1c83463
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mypy/stubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("_")
Expand Down Expand Up @@ -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__",
Expand Down

0 comments on commit 1c83463

Please sign in to comment.