Skip to content

Conversation

@rgant
Copy link
Contributor

@rgant rgant commented Feb 6, 2026

Summary

  • Override FileHandler.stream type to TextIOWrapper | None to reflect CPython's actual behavior
  • FileHandler sets self.stream = None in two code paths:
  • Added assert_type test for the new type in check_logging.py

rgant and others added 2 commits February 6, 2026 12:21
FileHandler sets self.stream = None in two CPython code paths:
delay=True in __init__ and after close(). Override the inherited
StreamHandler.stream type to reflect this.
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Thanks. One note about the test: We don't need that as it's basically restating the type annotations. typeshed's test are only used in complex situations.

@rgant rgant requested a review from srittau February 12, 2026 12:25
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau srittau merged commit da3de3a into python:main Feb 12, 2026
51 checks passed
@rgant rgant deleted the fix/filehandler-stream-none branch February 12, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants