Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 94d0d7e

Browse files
authored
stubtest: include function name in overload assertion messages (#20063)
I just managed to cause this assertion to fail (I'll open an issue about this soon), but the traceback did not tell me *where* in the stubs this occurred. Knowing the full name of the relevant function would've made the debugging process a lot easier.
1 parent 958e450 commit 94d0d7e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mypy/stubtest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ def from_overloadedfuncdef(stub: nodes.OverloadedFuncDef) -> Signature[nodes.Arg
968968

969969
is_arg_pos_only: defaultdict[str, set[bool]] = defaultdict(set)
970970
for func in map(_resolve_funcitem_from_decorator, stub.items):
971-
assert func is not None, "Failed to resolve decorated overload"
971+
assert func is not None, f"Failed to resolve decorated overload of {stub.fullname!r}"
972972
args = maybe_strip_cls(stub.name, func.arguments)
973973
for index, arg in enumerate(args):
974974
if (
@@ -984,7 +984,7 @@ def from_overloadedfuncdef(stub: nodes.OverloadedFuncDef) -> Signature[nodes.Arg
984984

985985
all_args: dict[str, list[tuple[nodes.Argument, int]]] = {}
986986
for func in map(_resolve_funcitem_from_decorator, stub.items):
987-
assert func is not None, "Failed to resolve decorated overload"
987+
assert func is not None, f"Failed to resolve decorated overload of {stub.fullname!r}"
988988
args = maybe_strip_cls(stub.name, func.arguments)
989989
for index, arg in enumerate(args):
990990
# For positional-only args, we allow overloads to have different names for the same

0 commit comments

Comments
 (0)