-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Support for pexpect.spawn(..., logfile=sys.stdout) #10976
Conversation
This comment has been minimized.
This comment has been minimized.
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.
Thanks! Looking at the source code, it might be better to just define a custom protocol, which we can use for both SpawnBase
and spawn
:
class _Logfile(Protocol):
def write(self, __s: str) -> object:...
def flush(self) -> object: ...
Source:
We already define a protocol like that elsewhere in typeshed. Maybe we should add it to Lines 1640 to 1641 in 6c5d1d3
EDIT: Actually, no, because we wouldn't be able to use that in our |
While I would be ok with that, I am not a huge fan of adding all sometimes-used permutations of I/O methods to (Also, |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
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.
Thanks!
We can set the logfile for pexpect's spawn using sys.stdout, but the type hint shows an error.