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

Fix invalid Python escape sequences #85818

Merged

Conversation

emklasson
Copy link
Contributor

Python leaves the backslash in invalid escape sequences so the results have so far functioned the same as properly escaping the backslashes. In Python 3.12 this causes SyntaxWarnings but future Python versions will raise SyntaxErrors (https://docs.python.org/3/whatsnew/3.12.html).

Running
% pycodestyle --select W605 $(find godot/ -name "*.py")

to find offending code yields:

godot//platform/windows/detect.py:484:44: W605 invalid escape sequence '\w'
godot//platform/windows/detect.py:484:52: W605 invalid escape sequence '\g'
godot//doc/tools/make_rst.py:1364:32: W605 invalid escape sequence '<'
godot//doc/tools/make_rst.py:1364:58: W605 invalid escape sequence '>'
godot//doc/tools/make_rst.py:2085:38: W605 invalid escape sequence '\ '
godot//doc/tools/make_rst.py:2087:38: W605 invalid escape sequence '\ '
godot//doc/tools/make_rst.py:2165:26: W605 invalid escape sequence '\ '
godot//doc/tools/make_rst.py:2167:26: W605 invalid escape sequence '\ '
godot//doc/tools/make_rst.py:2175:49: W605 invalid escape sequence '*'
godot//doc/tools/make_rst.py:2184:53: W605 invalid escape sequence '_'
godot//doc/tools/make_rst.py:2225:30: W605 invalid escape sequence '*'
godot//doc/tools/make_rst.py:2235:34: W605 invalid escape sequence '_'

This PR fixes all those issues by escaping the backslash.

@emklasson emklasson requested review from a team as code owners December 6, 2023 03:22
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

Looks good. Tested and confirmed this doesn't introduce any difference in the generated rst files.

@akien-mga akien-mga added bug topic:buildsystem cherrypick:3.x Considered for cherry-picking into a future 3.x release cherrypick:3.5 Considered for cherry-picking into a future 3.5.x release cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels Dec 6, 2023
@akien-mga akien-mga added this to the 4.3 milestone Dec 6, 2023
@akien-mga akien-mga merged commit cb570b2 into godotengine:master Dec 6, 2023
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

@emklasson
Copy link
Contributor Author

Many thanks! 🥳

@emklasson emklasson deleted the fix_invalid_escape_sequences branch December 6, 2023 23:32
@akien-mga
Copy link
Member

Cherry-picked for 4.2.1.

@akien-mga akien-mga removed the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Dec 7, 2023
@akien-mga
Copy link
Member

Cherry-picked for 3.6.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jan 16, 2024
@akien-mga
Copy link
Member

Cherry-picked for 3.5.4.

@akien-mga akien-mga removed the cherrypick:3.5 Considered for cherry-picking into a future 3.5.x release label Jan 16, 2024
@akien-mga
Copy link
Member

Cherry-picked for 4.1.4.

@akien-mga akien-mga removed the cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release label Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants