Skip to content

Commit 67f5c5b

Browse files
authored
tomllib: Add a comment about implicit lru_cache bound (GH-126078)
1 parent a64a1c9 commit 67f5c5b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Lib/tomllib/_re.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ def match_to_datetime(match: re.Match) -> datetime | date:
8484
return datetime(year, month, day, hour, minute, sec, micros, tzinfo=tz)
8585

8686

87+
# No need to limit cache size. This is only ever called on input
88+
# that matched RE_DATETIME, so there is an implicit bound of
89+
# 24 (hours) * 60 (minutes) * 2 (offset direction) = 2880.
8790
@lru_cache(maxsize=None)
8891
def cached_tz(hour_str: str, minute_str: str, sign_str: str) -> timezone:
8992
sign = 1 if sign_str == "+" else -1

0 commit comments

Comments
 (0)