From: Ben Darnell Date: Thu, 24 Jul 2014 02:18:27 +0000 (-0400) Subject: Fix a potential leak of an unclosed AsyncHTTPClient. X-Git-Tag: v4.1.0b1~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=253607ec7b3280b087b59f1f4f8695d1194b9b4c;p=thirdparty%2Ftornado.git Fix a potential leak of an unclosed AsyncHTTPClient. --- diff --git a/tornado/test/httpclient_test.py b/tornado/test/httpclient_test.py index 124239992..225911087 100644 --- a/tornado/test/httpclient_test.py +++ b/tornado/test/httpclient_test.py @@ -324,10 +324,12 @@ Transfer-Encoding: chunked # Construct a new instance of the configured client class client = self.http_client.__class__(self.io_loop, force_instance=True, defaults=defaults) - client.fetch(self.get_url('/user_agent'), callback=self.stop) - response = self.wait() - self.assertEqual(response.body, b'TestDefaultUserAgent') - client.close() + try: + client.fetch(self.get_url('/user_agent'), callback=self.stop) + response = self.wait() + self.assertEqual(response.body, b'TestDefaultUserAgent') + finally: + client.close() def test_304_with_content_length(self): # According to the spec 304 responses SHOULD NOT include