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
telnetlib module broken by str to unicode conversion #47975
Comments
Simple example: >>> from telnetlib import Telnet
>>> t = Telnet("google.com", 80)
>>> t.write("GET / HTTP/1.1\r\n")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/py3k/Lib/telnetlib.py", line 280, in write
self.sock.sendall(buffer)
TypeError: sendall() argument 1 must be string or buffer, not str
>>> t.write(b"GET / HTTP/1.1\r\n")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/py3k/Lib/telnetlib.py", line 277, in write
if IAC in buffer:
TypeError: Type str doesn't support the buffer API |
I think only bytes need to be allowed for write() and read*() because of |
I think that telnet should only use bytes (and not characters). For an Example to test the library (Starwars, telnet, ISO-8859-1): Example to test the library (Google, HTTP, ASCII): |
The patch looks pretty straightforward to me. If somebody else gives |
Yes, the patch is good. I think that documentation (both Doc\library\telnetlib.rst and the |
The patch is good. It's exactly what I told about in msg72132. |
Fixed in r66904. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: