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
ftplib.FTP.abort fails with TypeError on Python 3.x #56211
Comments
On Python 3.2, calling abort() on an ftplib.FTP object will cause an exception: >>> ftp = ftplib.FTP('localhost')
>>> ftp.abort()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.2/ftplib.py", line 246, in abort
self.sock.sendall(line, MSG_OOB)
TypeError: 'str' does not support the buffer interface The offending line, ftplib.py:246, should be replaced by |
Thanks for the report. If you would like to turn your suggestion into a diff file (see guidelines at http://docs.python.org/devguide) containing the code change and a test, you could get into the Misc/ACKS file and get eternal glory :) |
This is a nasty one and mainly it's the reason why there are no tests for abort() method. In practical terms this means that when the client calls self.sock.sendall(line, MSG_OOB) the server is supposed to call socket.recv(1024, MSG_OOB). The patch in attachment does this and also fixes FTP_TLS.abort() which is not able to accept the extra MSG_OOB flag argument. There's a side note: on certain platforms SO_OOBINLINE has no effect, resulting in asyncore's handle_expt method being called, see: |
New changeset 31220cd936d2 by Giampaolo Rodola' in branch '3.1': |
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: