Conversation
The intention is to eventually silence a couple warnings in mypy 1.19
about missing `self` arguments in the methods annotated by
`define_guard`, but this iteration does not work.
Instead, it exposed another error in `ViewStream` that is addressed in a
later commit.
error: Self argument missing for a non-static method (or an invalid type for self) [misc]
It is not possible to satisfy the type signature of `TextIOBase.readline` due to the conflict with `IOBase.readline` returning a different type while still being an inherited class. Instead, we claim that `ViewStream` implements the protocol (which is semantically equivalent).
Addresses the mypy 1.19 errors that complain about the first argument of
the wrapped guard function not being `self`.
Self argument missing for a non-static method (or an invalid type for self)
Arguably this also makes the classes easier to read.
deathaxe
approved these changes
Feb 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This required quite a bit of back and forth and I don't exactly consider the result to be readable, but at least it is correct now and it did, in fact, reveal another typing bug.
With these changes, we now pass typechecks in mypy 1.19 (which does not support Python 3.8 as defined in our
pyproject.tomland thus cannot be invoked viauv, but it doesn't hurt to be future-proof).