From 01fdfbd6407e555e3b9440e158950af0e73ef073 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Mon, 11 Mar 2024 19:46:09 +0100 Subject: [PATCH] some workarounds for using ... as sentinel until https://github.com/python/typing/issues/689 is fixed --- requests_oauth2client/authorization_request.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/requests_oauth2client/authorization_request.py b/requests_oauth2client/authorization_request.py index 98d50b5..91b5c22 100644 --- a/requests_oauth2client/authorization_request.py +++ b/requests_oauth2client/authorization_request.py @@ -6,7 +6,6 @@ import secrets from datetime import datetime from enum import Enum -from types import EllipsisType from typing import Any, Callable, ClassVar, Iterable, Sequence from attrs import Factory, asdict, field, fields, frozen @@ -312,11 +311,15 @@ def __init__( # noqa: PLR0913, C901 ) raise ValueError(msg) - if isinstance(state, EllipsisType): + if state is ...: state = self.generate_state() + if state is not None and not isinstance(state, str): + state = str(state) - if isinstance(nonce, EllipsisType): + if nonce is ...: nonce = self.generate_nonce() if scope is not None and "openid" in scope else None + if nonce is not None and not isinstance(nonce, str): + nonce = str(nonce) if not scope: scope = None