-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-109413: libregrtest: enable mypy's --strict-optional
check on most files
#112586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-109413: libregrtest: enable mypy's --strict-optional
check on most files
#112586
Conversation
… on most files
On hold until #112588 is merged |
Co-authored-by: Victor Stinner <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
Thanks @AlexWaygood for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
Sorry, @AlexWaygood, I could not cleanly backport this to
|
Sorry, @AlexWaygood, I could not cleanly backport this to
|
… on most files (python#112586) Co-authored-by: Victor Stinner <[email protected]>
GH-112602 is a backport of this pull request to the 3.12 branch. |
I added the "needs backport to 3.11" label to the 3.12 branch to take care of the 3.11 backport. |
…k on most files (#112586) (#112602) gh-109413: libregrtest: enable mypy's `--strict-optional` check on most files (#112586) Co-authored-by: Victor Stinner <[email protected]>
…` check on most files (pythonGH-112586) (pythonGH-112602) pythongh-109413: libregrtest: enable mypy's `--strict-optional` check on most files (pythonGH-112586) (cherry picked from commit 36dbebe) Co-authored-by: Alex Waygood <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
…l` check on most files (GH-112586) (GH-112602) (#112603) [3.12] gh-109413: libregrtest: enable mypy's `--strict-optional` check on most files (GH-112586) (GH-112602) gh-109413: libregrtest: enable mypy's `--strict-optional` check on most files (GH-112586) (cherry picked from commit 36dbebe) Co-authored-by: Alex Waygood <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
… on most files (python#112586) Co-authored-by: Victor Stinner <[email protected]>
… on most files (python#112586) Co-authored-by: Victor Stinner <[email protected]>
Mypy's
--strict-optional
check is one of its most important checks, and it's enabled by default when you run mypy. It warns you if it infers that an object might be of typeFoo | None
at runtime, even though the code is only guaranteed to work if the object is an instance ofFoo
.We currently have
--strict-optional
disabled on several files, as there were too many errors to deal with initially, and the priority was to have mypy enabled in CI so that we could work on improving the type annotations incrementally. This PR re-enables--strict-optional
on four files where it's easy to do so.