fix Telnet#expect (stdlib/telnetlib.pyi) #13377
Open
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.
telnetlib.Telnet#expect
copies given sequence and may modify it. https://github.com/python/cpython/blob/2dc476bcb9142cd25d7e1d52392b73a3dcdf1756/Lib/telnetlib.py#L612-L617So, when a read-only sequence contains
bytes
(e.g.tuple
ofbytes
) is passed toexpect
,TypeError
is raised at runtime.This PR fixes the argument type of the
list
parameter ofTelnet#expect
to rejectSequence
containingbytes
.I know telnetlib is already removed from stdlib in Python 3.13, but this fix may help users of 3.12 and future users of https://pypi.org/project/standard-telnetlib/ etc.