Skip to content

Commit ce1405d

Browse files
committed
fix: improve garbage collection via #698
1 parent 532cce6 commit ce1405d

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

authlib/oauth1/client.py

+3
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,6 @@ def parse_response_token(self, status_code, text):
170170
@staticmethod
171171
def handle_error(error_type, error_description):
172172
raise ValueError(f'{error_type}: {error_description}')
173+
174+
def __del__(self):
175+
del self.session

authlib/oauth2/auth.py

+4
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,7 @@ def prepare(self, uri, headers, body):
103103
uri, headers, body = hook(uri, headers, body)
104104

105105
return uri, headers, body
106+
107+
def __del__(self):
108+
del self.client
109+
del self.hooks

authlib/oauth2/client.py

+3
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,9 @@ def _http_post(self, url, body=None, auth=None, headers=None, **kwargs):
438438
url, data=dict(url_decode(body)),
439439
headers=headers, auth=auth, **kwargs)
440440

441+
def __del__(self):
442+
del self.session
443+
441444

442445
def _guess_grant_type(kwargs):
443446
if 'code' in kwargs:

0 commit comments

Comments
 (0)