[New-bugs-announce] [issue7927] SSL socket is not closed properly

Péter Szabó report at bugs.python.org
Sun Feb 14 12:25:26 CET 2010


New submission from Péter Szabó <ptspts at gmail.com>:

Here is how to reproduce:

import socket
import ssl
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sslsock = ssl.SSLSocket(sock)
assert sslsock._sslobj is None
sslsock.connect(('www.gmail.com', 443))
assert isinstance(sslsock._sslobj, socket._ssl.SSLType)
assert 0 == sslsock._makefile_refs
sslsock.makefile().close()
assert 1 == sslsock._makefile_refs  # Should be 0.
assert sslsock._sslobj is not None  # Should be None.

I think the problem is in SSLSocket.makefile, which initializes the _fileobject with close=False by default.

----------
components: Library (Lib)
messages: 99339
nosy: Péter.Szabó
severity: normal
status: open
title: SSL socket is not closed properly
type: resource usage
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7927>
_______________________________________


More information about the New-bugs-announce mailing list