Skip to content

Commit eca4c30

Browse files
authored
Typeshed cherry-pick: Use int | Any for types.FrameType.f_lineno (python#6935) (python#12240)
This fixes some regressions.
1 parent bb1fda3 commit eca4c30

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mypy/typeshed/stdlib/types.pyi

+4-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,10 @@ class FrameType:
354354
f_code: CodeType
355355
f_globals: dict[str, Any]
356356
f_lasti: int
357-
f_lineno: int | None
357+
# see discussion in #6769: f_lineno *can* sometimes be None,
358+
# but you should probably file a bug report with CPython if you encounter it being None in the wild.
359+
# An `int | None` annotation here causes too many false-positive errors.
360+
f_lineno: int | Any
358361
f_locals: dict[str, Any]
359362
f_trace: Callable[[FrameType, str, Any], Any] | None
360363
if sys.version_info >= (3, 7):

0 commit comments

Comments
 (0)