From 46ee530fc527871a5c6b02303a1769d7fb780755 Mon Sep 17 00:00:00 2001 From: Kurt McKee Date: Wed, 22 Oct 2025 07:24:46 -0500 Subject: [PATCH] Fix a `SyntaxWarning` caused by invalid escape sequences The warning is thrown when Python imports the file, and manifests in the test suite with this error: ``` jwt/api_jwt.py:326 /home/runner/work/pyjwt/pyjwt/jwt/api_jwt.py:326: SyntaxWarning: invalid escape sequence '\*' (e.g. HS\* and RS\*). ``` (This manifests as a `DeprecationWarning` as well, depending on the Python interpreter and version.) --- CHANGELOG.rst | 1 + jwt/api_jwt.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cb29564d..8b4a9cd5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,6 +14,7 @@ Fixed - Validate `iss` claim is a string during encoding and decoding by @pachewise in `#1040 `__ - Improve typing/logic for `options` in decode, decode_complete by @pachewise in `#1045 `__ - Declare float supported type for lifespan and timeout by @nikitagashkov in `#1068 `__ +- Fix ``SyntaxWarning``\s/``DeprecationWarning``\s caused by invalid escape sequences by @kurtmckee in `#1103 `__ Added ~~~~~ diff --git a/jwt/api_jwt.py b/jwt/api_jwt.py index 5bb53ee5..80760b52 100644 --- a/jwt/api_jwt.py +++ b/jwt/api_jwt.py @@ -323,7 +323,7 @@ def decode( configure it in the same place you configure the ``key``. Make sure not to mix symmetric and asymmetric algorithms that interpret the ``key`` in different ways - (e.g. HS\* and RS\*). + (e.g. HS\\* and RS\\*). :type algorithms: typing.Sequence[str] or None :param jwt.types.Options options: extended decoding and validation options