Closed Victor333Huesca closed 8 months ago
Hi,
Thanks for the review!
I notice you did forced-pushed
2 commits after, thus dropping this merge.
Was it intentional, is there a bug with this patch?
In some python scripts wrong use of raw strings may break escape characters
According to the official python documentation: https://docs.python.org/3/library/re.html
Regular expressions use the backslash character ('\') to indicate special forms or to allow special characters to be used without invoking their special meaning. This collides with Python’s usage of the same character for the same purpose in string literals; for example, to match a literal backslash, one might have to write '\\' as the pattern string, because the regular expression must be \, and each backslash must be expressed as \ inside a regular Python string literal. Also, please note that any invalid escape sequences in Python’s usage of the backslash in string literals now generate a SyntaxWarning and in the future this will become a SyntaxError. This behaviour will happen even if it is a valid escape sequence for a regular expression.
The solution is to use Python’s raw string notation for regular expression patterns; backslashes are not handled in any special way in a string literal prefixed with 'r'. So r"\n" is a two-character string containing '\' and 'n', while "\n" is a one-character string containing a newline. Usually patterns will be expressed in Python code using this raw string notation.
So I believe this is more likely to avoid SyntaxWarning
or SyntaxError
in the future.
If you feel like you prefer to do more testing or discard it completely but still want to benefit from the Fedora support, let me know, so I can separate this into two pull requests (or only keep the fedora patch, as you prefer).
When you use raw string, you should remove \
from strings.
You can make changes to *.sh to make Fedora support. Don't commit unrelated changes to the same pull request
Add support for Fedora 39 (tested under
WSL
).Use raw literal in python regex strings, this is the right way to escape regex's special characters in python. Otherwise, python first tries to escape the characters itself, fails and issue a warning which is confusing to user.
Checklist