From d4404dd6357db849935c9091c2f10f1333594907 Mon Sep 17 00:00:00 2001 From: Huanyi Xie <74809554+xiehuanyi@users.noreply.github.com> Date: Tue, 13 Oct 2026 21:34:23 +0300 Subject: [PATCH] Model missing readline history entries as optional strings --- stdlib/readline.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/readline.pyi b/stdlib/readline.pyi index aff1e504a174..c981463e3df2 100644 --- a/stdlib/readline.pyi +++ b/stdlib/readline.pyi @@ -1,7 +1,7 @@ import sys from _typeshed import StrOrBytesPath from collections.abc import Callable, Sequence -from typing import Literal, TypeAlias +from typing import Literal, SupportsIndex, TypeAlias if sys.platform != "win32": _Completer: TypeAlias = Callable[[str, int], str | None] @@ -19,7 +19,7 @@ if sys.platform != "win32": def set_history_length(length: int, /) -> None: ... def clear_history() -> None: ... def get_current_history_length() -> int: ... - def get_history_item(index: int, /) -> str: ... + def get_history_item(index: SupportsIndex, /) -> str | None: ... def remove_history_item(pos: int, /) -> None: ... def replace_history_item(pos: int, line: str, /) -> None: ... def add_history(string: str, /) -> None: ...