FTP/TLS fails if socket.setdefaulttimeout() is called

FWIW, this is an updated version for Python 2.7.  I still did not
try to get it working on Windows, I'm afraid.'

https://bugzilla.osafoundation.org/show_bug.cgi?id=2341
Port PyObject_AsReadBuffer to Py_buffer API

Required by the previous patch.

https://bugzilla.osafoundation.org/show_bug.cgi?id=13005