Skip to content

Commit

Permalink
fix: improve garbage collection via #698
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed Jan 28, 2025
1 parent 532cce6 commit ce1405d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions authlib/oauth1/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,6 @@ def parse_response_token(self, status_code, text):
@staticmethod
def handle_error(error_type, error_description):
raise ValueError(f'{error_type}: {error_description}')

def __del__(self):
del self.session
4 changes: 4 additions & 0 deletions authlib/oauth2/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,7 @@ def prepare(self, uri, headers, body):
uri, headers, body = hook(uri, headers, body)

return uri, headers, body

def __del__(self):
del self.client
del self.hooks
3 changes: 3 additions & 0 deletions authlib/oauth2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@ def _http_post(self, url, body=None, auth=None, headers=None, **kwargs):
url, data=dict(url_decode(body)),
headers=headers, auth=auth, **kwargs)

def __del__(self):
del self.session


def _guess_grant_type(kwargs):
if 'code' in kwargs:
Expand Down

0 comments on commit ce1405d

Please sign in to comment.