Skip to content

Commit f162dab

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

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

stdlib/@tests/stubtest_allowlists/common.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ _?ctypes.Union.__setattr__ # doesn't exist, but makes things easy if we pretend
238238
# Iterable classes that don't define __iter__ at runtime (usually iterable via __getitem__)
239239
# These would ideally be special-cased by type checkers; see https://github.com/python/mypy/issues/2220
240240
_?ctypes.Array.__iter__
241+
calendar._localized_day.__iter__
242+
calendar._localized_month.__iter__
241243

242244
dataclasses.KW_ONLY # white lies around defaults
243245

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)