Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mypy/suggestions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import itertools
import json
import os
import sys
from collections.abc import Iterator
from contextlib import contextmanager
from typing import Callable, NamedTuple, TypedDict, TypeVar, cast
Expand Down Expand Up @@ -549,12 +550,13 @@ def find_node(self, key: str) -> tuple[str, str, FuncDef]:
# TODO: Also return OverloadedFuncDef -- currently these are ignored.
node: SymbolNode | None = None
if ":" in key:
if key.count(":") > 1:
platform_key_count = 2 if sys.platform == "win32" else 1
if key.count(":") > platform_key_count:
raise SuggestionFailure(
"Malformed location for function: {}. Must be either"
" package.module.Class.method or path/to/file.py:line".format(key)
)
file, line = key.split(":")
file, line = key.rsplit(":", 1)
if not line.isdigit():
raise SuggestionFailure(f"Line number must be a number. Got {line}")
line_number = int(line)
Expand Down