This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nemunaire
Recipients nemunaire
Date 2016-07-26.23:21:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1469575305.76.0.392837082138.issue27629@psf.upfronthosting.co.za>
In-reply-to
Content
I got this stacktrace:
  File "test_ssl.py", line 3, in <module>
    sock = ssl.SSLSocket(server_hostname="docs.python.org")
  File "/usr/lib/python3.4/ssl.py", line 536, in __init__
    if sock.getsockopt(SOL_SOCKET, SO_TYPE) != SOCK_STREAM:
AttributeError: 'NoneType' object has no attribute 'getsockopt'

with this minimal code:
import ssl

sock = ssl.SSLSocket(server_hostname="docs.python.org")
sock.connect(("docs.python.org", 443))
sock.sendall(b"GET /3/library/ssl.html HTTP/1.0\r\nHost: docs.python.org\r\n\r\n")
print(sock.recv(4096).decode())

Whereas the None socket is correctly handled a few lines later: https://hg.python.org/cpython/file/tip/Lib/ssl.py#l715

All Python >= 3.3 are affected (since https://hg.python.org/cpython/rev/a00842b783cf) and can be patched with the same file, attached to this issue.
History
Date User Action Args
2016-07-26 23:21:45nemunairesetrecipients: + nemunaire
2016-07-26 23:21:45nemunairesetmessageid: <1469575305.76.0.392837082138.issue27629@psf.upfronthosting.co.za>
2016-07-26 23:21:45nemunairelinkissue27629 messages
2016-07-26 23:21:45nemunairecreate