Skip to content

Fix tornado escape#68723

Closed
harshang03 wants to merge 8 commits intosaltstack:masterfrom
harshang03:bugfix/68568-tornado-escape
Closed

Fix tornado escape#68723
harshang03 wants to merge 8 commits intosaltstack:masterfrom
harshang03:bugfix/68568-tornado-escape

Conversation

@harshang03
Copy link
Copy Markdown

What does this PR do?

Avoids Python 3.12+ SyntaxWarning for invalid escape sequences by moving the Tornado re_unescape docstring into a raw-string payload and assigning it at runtime. This keeps \d/regex references intact without triggering warnings.

What issues does this PR fix or reference?

Fixes #68568

Previous Behavior

Importing the vendored Tornado util module could emit SyntaxWarning: invalid escape sequence '\d' under Python 3.12+.

New Behavior

No syntax warnings; re_unescape uses a safe, runtime-assigned docstring while preserving content.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

No

@whytewolf
Copy link
Copy Markdown
Collaborator

this "fix" reads like war and peace. and the gunslinger decided to get together. it is all over the place and doesn't actually touch the bug in question. It is horriblely written, goes no where. and is a failure on all parts. it is honestly one of the worst PR's i have ever seen.

Even marked as WIP this needs to be closed. as there is no work that can fix this.

Copy link
Copy Markdown
Contributor

@twangboy twangboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 3 files that I marked "Keep this file". The rest are fluff, please remove them as they have nothing to do with the described change. We also need a changelog for this.

The rest of the files would need to go in separate, smaller PRs.

Comment thread salt/ext/tornado/util.py
re_unescape.__doc__ = tornado_utils.RE_UNESCAPE_DOC

__all__ = ["RE_UNESCAPE_PATTERN", "re_unescape"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this file

Comment thread salt/utils/tornado.py
re_unescape.__doc__ = RE_UNESCAPE_DOC

__all__ = ["RE_UNESCAPE_DOC", "RE_UNESCAPE_PATTERN", "re_unescape"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this file


def test_re_unescape_docstring_includes_backslash():
assert "``\\d``" in tornado_utils.RE_UNESCAPE_DOC

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this file

@twangboy twangboy added test:full Run the full test suite Abandoned and removed Abandoned labels Mar 16, 2026
@twangboy
Copy link
Copy Markdown
Contributor

Additionally, this PR should be against the 3006.x branch. Vendored tornado has been removed in 3007.x and forward

@twangboy twangboy added this to the Sulpher v3006.24 milestone Mar 16, 2026
@dwoz dwoz closed this Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: SyntaxWarning: invalid escape sequence '\d' on Salt: 3006.16 with salt/ext/tornado/util.py

4 participants