OpenTTD / nml

NewGRF Meta Language
GNU General Public License v2.0
44 stars 36 forks source link

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

Closed glx22 closed 1 month ago

glx22 commented 2 months ago

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 commented 2 months ago

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... ;)