From 6bfe4ef600795724d2a8382ed189c96c63e1b9e0 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 17 Jan 2022 09:04:46 +0000 Subject: [PATCH] Use `int | Any` for `types.FrameType.f_lineno` Refs discussion in #6769 --- stdlib/types.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdlib/types.pyi b/stdlib/types.pyi index cf30cbd64322..a2926fac6aaa 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -346,7 +346,10 @@ class FrameType: f_code: CodeType f_globals: dict[str, Any] f_lasti: int - f_lineno: int | None + # see discussion in #6769: f_lineno *can* sometimes be None, + # but you should probably file a bug report with CPython if you encounter it being None in the wild. + # An `int | None` annotation here causes too many false-positive errors. + f_lineno: int | Any f_locals: dict[str, Any] f_trace: Callable[[FrameType, str, Any], Any] | None if sys.version_info >= (3, 7):