Fix memory leak of Stream objects in HTTP20Connection
This commit is contained in:
committed by
Sergey Petrov
parent
15ca6f6b62
commit
92a04546f9
+5
-4
@@ -37,7 +37,8 @@ class APNsClient(object):
|
||||
url = '/3/device/{}'.format(token_hex)
|
||||
stream_id = self.__connection.request('POST', url, json_payload, headers)
|
||||
resp = self.__connection.get_response(stream_id)
|
||||
if resp.status != 200:
|
||||
raw_data = resp.read().decode('utf-8')
|
||||
data = json.loads(raw_data)
|
||||
raise exception_class_for_reason(data['reason'])
|
||||
with resp:
|
||||
if resp.status != 200:
|
||||
raw_data = resp.read().decode('utf-8')
|
||||
data = json.loads(raw_data)
|
||||
raise exception_class_for_reason(data['reason'])
|
||||
|
||||
Reference in New Issue
Block a user