Skip to content

Clean up type hints for subprocess - #3557

Merged
A5rocks merged 2 commits into
python-trio:mainfrom
A5rocks:clean-up-typehints
Oct 23, 2026
Merged

A5rocks merged 2 commits into
python-trio:mainfrom
A5rocks:clean-up-typehints

Conversation

@A5rocks

@A5rocks A5rocks commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Followup for my review of #3555

@A5rocks
A5rocks requested a review from Zac-HD October 23, 2026 03:42
@A5rocks A5rocks added the skip newsfragment Newsfragment is not required label Oct 23, 2026
@A5rocks
A5rocks force-pushed the clean-up-typehints branch 2 times, most recently from d5c8a79 to 18280f4 Compare October 23, 2026 03:53
@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00000%. Comparing base (b8d658a) to head (b851385).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@               Coverage Diff               @@
##                 main        #3557   +/-   ##
===============================================
  Coverage   100.00000%   100.00000%           
===============================================
  Files             128          128           
  Lines           19480        19480           
  Branches         1323         1323           
===============================================
  Hits            19480        19480           
Files with missing lines Coverage Δ
src/trio/_subprocess.py 100.00000% <100.00000%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/trio/_subprocess.py Outdated
Comment thread src/trio/_subprocess.py
trio_stdin: ClosableSendStream | None = None
trio_stdout: ClosableReceiveStream | None = None
trio_stderr: ClosableReceiveStream | None = None
trio_stdin = None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am surprised mypy strict mode is alright with this (then again I don't think we have that turned on be default)

Seeing this here and knowing this is likely a mypy strict mode thing, I wouldn't be surprised if this is one of my contributions for a future where we do enable strict mode

@A5rocks A5rocks Oct 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mypy has a ton of special behavior around None where it will look around at context to figure out the right type hint.

See https://mypy-play.net/?mypy=latest&python=3.12&flags=strict&gist=2c203611ecce92bee7a12ef01ab7d524 for an example. (Also at some point I might switch us to using allow-redefinition, mypy's done a new version of it since I last tried that and probably it's less buggy!)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. Looks like things have changed from what I remember we had to do previously.

@Zac-HD Zac-HD left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, though it'd be nice to include a link to the pyright issue

@A5rocks
A5rocks force-pushed the clean-up-typehints branch from 18280f4 to b851385 Compare October 23, 2026 04:17
@A5rocks
A5rocks enabled auto-merge October 23, 2026 04:18
@A5rocks
A5rocks merged commit c631a83 into python-trio:main Oct 23, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newsfragment Newsfragment is not required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants