GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-109413: libregrtest: enable mypy's `--strict-optional` check on most files by AlexWaygood · Pull Request #112586 · python/cpython

Conversation

@AlexWaygood

@AlexWaygood AlexWaygood commented Dec 1, 2023 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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 type Foo | None at runtime, even though the code is only guaranteed to work if the object is an instance of Foo.

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.

  • Issue: libregrtest: Improve type hints; explore running mypy in CI #109413

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@AlexWaygood
pythongh-109413: libregrtest: enable mypy's --strict-optional check…
17b123b
… on most files
@AlexWaygood
AlexWaygood requested a review from vstinner December 1, 2023 12:23
@bedevere-app bedevere-app Bot added the awaiting core review label Dec 1, 2023
@bedevere-app bedevere-app Bot mentioned this pull request Dec 1, 2023
libregrtest: Improve type hints; explore running mypy in CI #109413
Closed
@AlexWaygood AlexWaygood added the skip news label Dec 1, 2023
vstinner
vstinner reviewed Dec 1, 2023
View reviewed changes
Comment thread Lib/test/libregrtest/runtests.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/libregrtest/single.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/libregrtest/utils.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

AlexWaygood
AlexWaygood commented Dec 1, 2023
View reviewed changes
Comment thread Lib/test/libregrtest/utils.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

AlexWaygood and others added 3 commits December 1, 2023 12:36
@AlexWaygood @vstinner
reject also the empty string
25e9d39
Co-authored-by: Victor Stinner <[email protected]>
@AlexWaygood
fix incorrect change in results.py
1e8b938
@AlexWaygood
revert changes to runtests.py, Victor's PR does it better
563db9a
@AlexWaygood

AlexWaygood commented Dec 1, 2023

Copy link
Copy Markdown
Member Author

On hold until #112588 is merged

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood
AlexWaygood marked this pull request as draft December 1, 2023 13:10
@bedevere-app bedevere-app Bot removed the awaiting core review label Dec 1, 2023
vstinner
vstinner reviewed Dec 1, 2023
View reviewed changes
Comment thread Lib/test/libregrtest/results.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood @vstinner
ValueError
028b8be
Co-authored-by: Victor Stinner <[email protected]>
vstinner
vstinner approved these changes Dec 1, 2023
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AlexWaygood reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@bedevere-app bedevere-app Bot added the awaiting merge label Dec 1, 2023
@AlexWaygood
Merge branch 'main' into libregrtest-easy-strict-optional
2f5bed2
@AlexWaygood
AlexWaygood marked this pull request as ready for review December 1, 2023 13:49
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting merge labels Dec 1, 2023
@AlexWaygood
AlexWaygood enabled auto-merge (squash) December 1, 2023 13:55
@AlexWaygood AlexWaygood added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Dec 1, 2023
@AlexWaygood
AlexWaygood merged commit 70a38ff into python:main Dec 1, 2023
@AlexWaygood
AlexWaygood deleted the libregrtest-easy-strict-optional branch December 1, 2023 14:54
@miss-islington-app

miss-islington-app Bot commented Dec 1, 2023

Copy link
Copy Markdown

Thanks @AlexWaygood for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting core review label Dec 1, 2023
@miss-islington-app

miss-islington-app Bot commented Dec 1, 2023

Copy link
Copy Markdown

Sorry, @AlexWaygood, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 70a38ffb3d712f973eb17bd1bda541f238ae70d2 3.12
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app miss-islington-app Bot assigned AlexWaygood Dec 1, 2023
@miss-islington-app

miss-islington-app Bot commented Dec 1, 2023

Copy link
Copy Markdown

Sorry, @AlexWaygood, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 70a38ffb3d712f973eb17bd1bda541f238ae70d2 3.11
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AlexWaygood added a commit to AlexWaygood/cpython that referenced this pull request Dec 1, 2023
@AlexWaygood @vstinner
pythongh-109413: libregrtest: enable mypy's --strict-optional check…
26306e4
… on most files (python#112586)

Co-authored-by: Victor Stinner <[email protected]>
@bedevere-app

bedevere-app Bot commented Dec 1, 2023

Copy link
Copy Markdown

GH-112602 is a backport of this pull request to the 3.12 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.12 only security fixes label Dec 1, 2023
@AlexWaygood AlexWaygood removed the needs backport to 3.11 only security fixes label Dec 1, 2023
@AlexWaygood

AlexWaygood commented Dec 1, 2023

Copy link
Copy Markdown
Member Author

I added the "needs backport to 3.11" label to the 3.12 branch to take care of the 3.11 backport.

vstinner reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AlexWaygood added a commit that referenced this pull request Dec 1, 2023
@AlexWaygood @vstinner
[3.12] gh-109413: libregrtest: enable mypy's --strict-optional chec…
36dbebe
…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]>
@miss-islington miss-islington mentioned this pull request Dec 1, 2023
[3.11] [3.12] gh-109413: libregrtest: enable mypy's --strict-optional check on most files (GH-112586) (GH-112602) #112603
Merged
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 1, 2023
@AlexWaygood @vstinner @miss-islington
[3.12] pythongh-109413: libregrtest: enable mypy's `--strict-optional…
f4d2bdd
…` 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]>
AlexWaygood added a commit that referenced this pull request Dec 1, 2023
@miss-islington @AlexWaygood @vstinner
[3.11] [3.12] gh-109413: libregrtest: enable mypy's `--strict-optiona…
da33204
…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]>
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
@AlexWaygood @vstinner @aisk
pythongh-109413: libregrtest: enable mypy's --strict-optional check…
0749ad2
… on most files (python#112586)

Co-authored-by: Victor Stinner <[email protected]>
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
@AlexWaygood @vstinner @Glyphack
pythongh-109413: libregrtest: enable mypy's --strict-optional check…
492a7da
… on most files (python#112586)

Co-authored-by: Victor Stinner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@AlexWaygood AlexWaygood

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@AlexWaygood @vstinner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.