Skip to content

Commit e072a36

Browse files
committed
calendar: fix iteration
Fixes #15826
1 parent df45287 commit e072a36

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

stdlib/@tests/stubtest_allowlists/common.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,11 @@ _?ctypes.Union.__getattr__ # doesn't exist, but makes things easy if we pretend
236236
_?ctypes.Union.__setattr__ # doesn't exist, but makes things easy if we pretend it does
237237

238238
# Iterable classes that don't define __iter__ at runtime (usually iterable via __getitem__)
239-
# These would ideally be special-cased by type checkers; see https://github.com/python/mypy/issues/2220
239+
# These would ideally be special-cased by type checkers.
240+
# See https://github.com/python/mypy/issues/2220 and https://github.com/python/typeshed/issues/7813
240241
_?ctypes.Array.__iter__
242+
calendar._localized_day.__iter__
243+
calendar._localized_month.__iter__
241244

242245
dataclasses.KW_ONLY # white lies around defaults
243246

stdlib/calendar.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import datetime
22
import enum
33
import sys
44
from _typeshed import Unused
5-
from collections.abc import Iterable
5+
from collections.abc import Iterable, Iterator
66
from time import struct_time
77
from typing import ClassVar, Final, TypeAlias, overload
88

@@ -170,6 +170,7 @@ class _localized_month:
170170
def __getitem__(self, i: slice) -> list[str]: ...
171171

172172
def __len__(self) -> int: ...
173+
def __iter__(self) -> Iterator[str]: ...
173174

174175
class _localized_day:
175176
format: str
@@ -181,6 +182,7 @@ class _localized_day:
181182
def __getitem__(self, i: slice) -> list[str]: ...
182183

183184
def __len__(self) -> int: ...
185+
def __iter__(self) -> Iterator[str]: ...
184186

185187
day_name: _localized_day
186188
day_abbr: _localized_day

0 commit comments

Comments
 (0)