Fix tornado escape#68723
Conversation
|
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. |
twangboy
left a comment
There was a problem hiding this comment.
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.
| re_unescape.__doc__ = tornado_utils.RE_UNESCAPE_DOC | ||
|
|
||
| __all__ = ["RE_UNESCAPE_PATTERN", "re_unescape"] | ||
|
|
| re_unescape.__doc__ = RE_UNESCAPE_DOC | ||
|
|
||
| __all__ = ["RE_UNESCAPE_DOC", "RE_UNESCAPE_PATTERN", "re_unescape"] | ||
|
|
|
|
||
| def test_re_unescape_docstring_includes_backslash(): | ||
| assert "``\\d``" in tornado_utils.RE_UNESCAPE_DOC | ||
|
|
|
Additionally, this PR should be against the 3006.x branch. Vendored tornado has been removed in 3007.x and forward |
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