New submission from Andrew Bennetts <s...@users.sourceforge.net>:

ython 2.6.6 (r266:84292, Aug 24 2010, 21:47:18) 
[GCC 4.4.5 20100816 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket, ssl
>>> s = socket.socket()
>>> wrapped = ssl.wrap_socket(s)
>>> wrapped.recv(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/ssl.py", line 217, in recv
    return socket.recv(self, buflen, flags)
TypeError: 'member_descriptor' object is not callable


What I expected was a more helpful error, like the unwrapped socket gives:

>> s.recv(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.error: [Errno 107] Transport endpoint is not connected


The full list of affected methods are all the _delegate_methods from socket.py:

_delegate_methods = ("recv", "recvfrom", "recv_into", "recvfrom_into",
                     "send", "sendto")

The cause is that the SSLSocket subclass is trying to upcall to the 
_socketobject base class, but the base does not have methods for those, just 
__slots__ for the instance to fill in with bound methods.

----------
messages: 115286
nosy: spiv
priority: normal
severity: normal
status: open
title: Unconnected SSLSocket.{send,recv} raises TypeError: 'member_descriptor' 
object is not callable
versions: Python 2.6, Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9729>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to