New submission from STINNER Victor: Attached patch fixes 3 ResourceWarning warnings in Lib/test/test_urllib2_localnet.py.
See also issue #26612 (test_ssl). Example of warning logged by "./python -X tracemalloc=25 -m test -v test_urllib2_localnet ": --- /home/haypo/prog/python/default/Lib/test/support/__init__.py:1444: ResourceWarning: unclosed <socket.socket [closed] fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6> gc.collect() Object allocated at (most recent call first): File "/home/haypo/prog/python/default/Lib/socket.py", lineno 697 sock = socket(af, socktype, proto) File "/home/haypo/prog/python/default/Lib/http/client.py", lineno 898 (self.host,self.port), self.timeout, self.source_address) File "/home/haypo/prog/python/default/Lib/http/client.py", lineno 926 self.connect() File "/home/haypo/prog/python/default/Lib/http/client.py", lineno 983 self.send(msg) File "/home/haypo/prog/python/default/Lib/http/client.py", lineno 1151 self._send_output(message_body) File "/home/haypo/prog/python/default/Lib/http/client.py", lineno 1200 self.endheaders(body) File "/home/haypo/prog/python/default/Lib/http/client.py", lineno 1155 self._send_request(method, url, body, headers) File "/home/haypo/prog/python/default/Lib/urllib/request.py", lineno 1303 h.request(req.get_method(), req.selector, req.data, headers) File "/home/haypo/prog/python/default/Lib/urllib/request.py", lineno 1331 return self.do_open(http.client.HTTPConnection, req) File "/home/haypo/prog/python/default/Lib/urllib/request.py", lineno 503 result = func(*args) File "/home/haypo/prog/python/default/Lib/urllib/request.py", lineno 543 '_open', req) File "/home/haypo/prog/python/default/Lib/urllib/request.py", lineno 525 response = self._open(req, data) File "/home/haypo/prog/python/default/Lib/urllib/request.py", lineno 222 return opener.open(url, data, timeout) File "/home/haypo/prog/python/default/Lib/test/test_urllib2_localnet.py", lineno 595 urllib.request.urlopen(req) (...) --- ---------- components: Tests messages: 262258 nosy: haypo, martin.panter priority: normal severity: normal status: open title: Fix ResourceWarning warnings in test_urllib2_localnet type: resource usage versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26620> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com