From eca4c300111a8c12e402acbada35badbd3c705f8 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Tue, 22 Feb 2022 17:08:01 +0000 Subject: [PATCH] Typeshed cherry-pick: Use `int | Any` for `types.FrameType.f_lineno` (#6935) (#12240) This fixes some regressions. --- mypy/typeshed/stdlib/types.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mypy/typeshed/stdlib/types.pyi b/mypy/typeshed/stdlib/types.pyi index 92f8daa7ebed8..caf745b99554e 100644 --- a/mypy/typeshed/stdlib/types.pyi +++ b/mypy/typeshed/stdlib/types.pyi @@ -354,7 +354,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):