Skip to content

Fix #340: Always use raw strings for token regex#341

Merged
glx22 merged 1 commit intoOpenTTD:masterfrom
glx22:fix_340
Oct 6, 2024
Merged

Fix #340: Always use raw strings for token regex#341
glx22 merged 1 commit intoOpenTTD:masterfrom
glx22:fix_340

Conversation

@glx22
Copy link
Contributor

@glx22 glx22 commented Oct 5, 2024

Whitespace handling in parser doesn't use raw string for the token rule, but it should have.
It somehow works when not using raw string with python <3.13, but fails with python 3.13.
Use raw strings for all token regular expressions.

@LordAro
Copy link
Member

LordAro commented Oct 5, 2024

I can't find anything either, though they've definitely been making changes in that area - this is in 3.12:

A backslash-character pair that is not a valid escape sequence now generates a SyntaxWarning, instead of DeprecationWarning. For example, re.compile("\d+.\d+") now emits a SyntaxWarning ("\d" is an invalid escape sequence, use raw strings for regular expression: re.compile(r"\d+.\d+")). In a future Python version, SyntaxError will eventually be raised, instead of SyntaxWarning. (Contributed by Victor Stinner in gh-98401.)

Maybe we should report a bug... ;)

@glx22 glx22 merged commit 166ea00 into OpenTTD:master Oct 6, 2024
@glx22 glx22 deleted the fix_340 branch October 6, 2024 15:58
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

Successfully merging this pull request may close these issues.

2 participants