diff --git a/jwt/api_jws.py b/jwt/api_jws.py index f90c30f9..adc9b572 100644 --- a/jwt/api_jws.py +++ b/jwt/api_jws.py @@ -186,6 +186,7 @@ def decode_complete( "and will be removed in pyjwt version 3. " f"Unsupported kwargs: {tuple(kwargs.keys())}", RemovedInPyjwt3Warning, + stacklevel=2, ) if options is None: options = {} @@ -231,6 +232,7 @@ def decode( "and will be removed in pyjwt version 3. " f"Unsupported kwargs: {tuple(kwargs.keys())}", RemovedInPyjwt3Warning, + stacklevel=2, ) decoded = self.decode_complete( jwt, key, algorithms, options, detached_payload=detached_payload diff --git a/jwt/api_jwt.py b/jwt/api_jwt.py index 6adcffbb..6d4df399 100644 --- a/jwt/api_jwt.py +++ b/jwt/api_jwt.py @@ -122,6 +122,7 @@ def decode_complete( "and will be removed in pyjwt version 3. " f"Unsupported kwargs: {tuple(kwargs.keys())}", RemovedInPyjwt3Warning, + stacklevel=2, ) options = dict(options or {}) # shallow-copy or initialize an empty dict options.setdefault("verify_signature", True) @@ -135,6 +136,7 @@ def decode_complete( "The equivalent is setting `verify_signature` to False in the `options` dictionary. " "This invocation has a mismatch between the kwarg and the option entry.", category=DeprecationWarning, + stacklevel=2, ) if not options["verify_signature"]: @@ -202,6 +204,7 @@ def decode( "and will be removed in pyjwt version 3. " f"Unsupported kwargs: {tuple(kwargs.keys())}", RemovedInPyjwt3Warning, + stacklevel=2, ) decoded = self.decode_complete( jwt,