Skip to content

Fix invalid escape sequence SyntaxWarnings#66

Merged
kevin1024 merged 1 commit into
mainfrom
fix-escape-warnings
Jun 16, 2026
Merged

Fix invalid escape sequence SyntaxWarnings#66
kevin1024 merged 1 commit into
mainfrom
fix-escape-warnings

Conversation

@kevin1024

Copy link
Copy Markdown

The two ASCII-art string literals and the parse_multi_value_header() regex use unrecognized escape sequences (\_, \ , \s). These emit a SyntaxWarning on Python 3.12+ (a DeprecationWarning before that) and will become a SyntaxError in a future Python. Closes #62.

  • Make the three literals raw strings. The rendered ASCII art and the regex behaviour are byte-for-byte unchanged — verified by comparing the string values and parse_multi_value_header output before/after.
  • Add a regression test that compiles every module in the httpbin package with escape-sequence warnings escalated to errors (fails on the old code, passes on the fix).

Based on #55 (@gesh / hseg), itself a rebase of postmanlabs#646, with a regression test added. Supersedes #55.

The two ASCII-art literals and the parse_multi_value_header() regex used
unrecognized escape sequences (\_, \ , \s), which emit a SyntaxWarning on
Python 3.12+ (DeprecationWarning earlier) and will become a SyntaxError in a
future Python. Make them raw strings; the rendered art and regex behaviour are
byte-for-byte unchanged (verified against the prior values).

Adds a regression test that compiles every module in the httpbin package with
escape-sequence warnings escalated to errors.

Closes #62. Supersedes #55.

Co-Authored-By: gesh <gesh@gesh.uni.cx>
@kevin1024 kevin1024 merged commit b782143 into main Jun 16, 2026
41 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SyntaxWarning: invalid escape sequence

1 participant