classification
Title: SSL sockets don't give resource warnings
Type: behavior Stage: resolved
Components: Versions: Python 3.4, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, pitrou, python-dev
Priority: normal Keywords:

Created on 2013-01-08 23:17 by benjamin.peterson, last changed 2013-01-10 20:17 by python-dev. This issue is now closed.

Messages (3)
msg179394 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-01-08 23:17
Python 3.3.0+ (3.3:ab36d3bb5996+, Jan  8 2013, 17:08:35) 
[GCC 4.5.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> del s
__main__:1: ResourceWarning: unclosed <socket.socket object, fd=3, family=2, type=1, proto=0>
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> import ssl
>>> ssl.wrap_socket(s)
<ssl.SSLSocket object, fd=3, family=2, type=1, proto=0>
>>> del s

We can just remove the __del__ on SSLSocket, right?
msg179590 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-01-10 20:03
Indeed, SSLSocket.__del__ doesn't seem to have a point.
msg179593 - (view) Author: Roundup Robot (python-dev) Date: 2013-01-10 20:17
New changeset c8105251cc1f by Benjamin Peterson in branch '3.3':
remove __del__ because it's evil and also prevents the ResourceWarning on the socket from happening (closes #16900)
http://hg.python.org/cpython/rev/c8105251cc1f

New changeset e23d51f17cce by Benjamin Peterson in branch 'default':
merge 3.3 (#16900)
http://hg.python.org/cpython/rev/e23d51f17cce
History
Date User Action Args
2013-01-10 20:17:07python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg179593

resolution: fixed
stage: needs patch -> resolved
2013-01-10 20:03:16pitrousetnosy: + pitrou

messages: + msg179590
stage: needs patch
2013-01-08 23:17:40benjamin.petersoncreate