urequests: content: Use finally to close socket regardless of possible error.

pull/208/head
Paul Sokolovsky 2017-09-13 15:17:28 +03:00
rodzic 586ae64cb0
commit 2e834672aa
1 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -16,7 +16,9 @@ class Response:
@property
def content(self):
if self._cached is None:
try:
self._cached = self.raw.read()
finally:
self.raw.close()
self.raw = None
return self._cached