diff --git a/stdlib/@tests/stubtest_allowlists/py315.txt b/stdlib/@tests/stubtest_allowlists/py315.txt index fcd88edaf791..846657842ce8 100644 --- a/stdlib/@tests/stubtest_allowlists/py315.txt +++ b/stdlib/@tests/stubtest_allowlists/py315.txt @@ -29,9 +29,6 @@ importlib.resources._common.package_to_anchor mailbox._ProxyFile.__class_getitem__ multiprocessing.process.BaseProcess.__init__ threading.Condition.locked -tkinter.Image.__iter__ -tkinter.Misc.__iter__ -tkinter.font.Font.__iter__ # ============================================================= # Allowlist entries that cannot or should not be fixed; >= 3.15 diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 681c6ddba546..a33f30adcbb9 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -390,6 +390,9 @@ class Misc: master: Misc | None tk: _tkinter.TkappType children: dict[str, Widget] + if sys.version_info >= (3, 15): + __iter__: ClassVar[None] # prevent using __getitem__ for iteration + def destroy(self) -> None: ... def deletecommand(self, name: str) -> None: ... def tk_strictMotif(self, boolean=None): ... @@ -3939,6 +3942,9 @@ class _PhotoImageLike(_Image): ... class Image(_Image): name: Incomplete tk: _tkinter.TkappType + if sys.version_info >= (3, 15): + __iter__: ClassVar[None] # prevent using __getitem__ for iteration + def __init__(self, imgtype, name=None, cnf={}, master: Misc | _tkinter.TkappType | None = None, **kw) -> None: ... def __del__(self) -> None: ... def __setitem__(self, key, value) -> None: ... diff --git a/stdlib/tkinter/font.pyi b/stdlib/tkinter/font.pyi index d9e0b1315590..72552eb8e251 100644 --- a/stdlib/tkinter/font.pyi +++ b/stdlib/tkinter/font.pyi @@ -1,5 +1,6 @@ import _tkinter import itertools +import sys import tkinter from typing import Any, ClassVar, Final, Literal, TypeAlias, TypedDict, overload, type_check_only from typing_extensions import Unpack @@ -41,6 +42,8 @@ class _MetricsDict(TypedDict): class Font: name: str delete_font: bool + if sys.version_info >= (3, 15): + __iter__: ClassVar[None] # prevent using __getitem__ for iteration counter: ClassVar[itertools.count[int]] # undocumented def __init__( self,