Skip to content

Commit 52975f6

Browse files
authored
Ignore a few override errors in typeshed (#19079)
I was seeing errors like these in our Bazel-based mypy configuration, which may type check typeshed in some non-standard way: ``` mypy/typeshed/stdlib/tempfile.pyi:390: error: Argument 1 of "writelines" is incompatible with supertype "_IOBase"; supertype defines the argument type as "Iterable[Buffer]" [override] mypy/typeshed/stdlib/tempfile.pyi:390: note: This violates the Liskov substitution principle mypy/typeshed/stdlib/tempfile.pyi:390: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides mypy/typeshed/stdlib/tkinter/ttk.pyi:565: error: Signature of "forget" incompatible with supertype "Pack" [override] mypy/typeshed/stdlib/tkinter/ttk.pyi:565: note: Superclass: mypy/typeshed/stdlib/tkinter/ttk.pyi:565: note: def pack_forget(self) -> None mypy/typeshed/stdlib/tkinter/ttk.pyi:565: note: Subclass: mypy/typeshed/stdlib/tkinter/ttk.pyi:565: note: def forget(self, tab_id: Any) -> None ``` I'm just merging this directly to the mypy repo so that I can move forward more quickly, as this is needed to unblock the public release.
1 parent 1a2dccf commit 52975f6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mypy/typeshed/stdlib/tempfile.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ class SpooledTemporaryFile(IO[AnyStr], _SpooledTemporaryFileBase):
387387
def write(self: SpooledTemporaryFile[bytes], s: ReadableBuffer) -> int: ...
388388
@overload
389389
def write(self, s: AnyStr) -> int: ...
390-
@overload
390+
@overload # type: ignore[override]
391391
def writelines(self: SpooledTemporaryFile[str], iterable: Iterable[str]) -> None: ...
392392
@overload
393393
def writelines(self: SpooledTemporaryFile[bytes], iterable: Iterable[ReadableBuffer]) -> None: ...

mypy/typeshed/stdlib/tkinter/ttk.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ class Notebook(Widget):
562562
compound: tkinter._Compound = ...,
563563
underline: int = ...,
564564
) -> None: ...
565-
def forget(self, tab_id) -> None: ...
565+
def forget(self, tab_id) -> None: ... # type: ignore[override]
566566
def hide(self, tab_id) -> None: ...
567567
def identify(self, x: int, y: int) -> str: ...
568568
def index(self, tab_id): ...

0 commit comments

Comments
 (0)