Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxWarning: invalid escape sequence #883

Open
StanBorbatTR opened this issue Jan 13, 2025 · 0 comments
Open

SyntaxWarning: invalid escape sequence #883

StanBorbatTR opened this issue Jan 13, 2025 · 0 comments

Comments

@StanBorbatTR
Copy link

StanBorbatTR commented Jan 13, 2025

I get warnings when initializing 3.133.0 using Python 3.12. The messages are below:

/var/task/settings.py:169: SyntaxWarning: invalid escape sequence '\d'
"REDACT_IP", "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}", "xxx.xxx.xxx.xxx"
/var/task/settings.py:173: SyntaxWarning: invalid escape sequence '\.'
"[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+",
/var/task/steps/common.py:12: SyntaxWarning: invalid escape sequence '\d'
"\d+_CloudTrail(|-Digest|-Insight)_\w{2}(|-gov|-cn)-\w{4,9}-\d_(|.+)\d{8}T\d{4,6}Z(|.+).json.gz$",

It seems that Python 3.12 has made those Syntax Warnings.

Python 3.11

Python 3.11.10 (main, Sep  7 2024, 01:03:31) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> test = "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"

Python 3.12

Python 3.12.7 (main, Oct  1 2024, 02:05:46) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> test = "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"
<stdin>:1: SyntaxWarning: invalid escape sequence '\d'

Perhaps those should be marked as regular expressions like so:

Python 3.12.7 (main, Oct  1 2024, 02:05:46) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> test = r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"
@StanBorbatTR StanBorbatTR changed the title SyntaxWarning: invalid escape sequence '\d' SyntaxWarning: invalid escape sequence Jan 13, 2025
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

No branches or pull requests

1 participant