trampgeek / jobe

jobe is a server that runs small programming jobs in a variety of programming languages
MIT License
108 stars 78 forks source link

Fix SyntaxWarning in Python 3.12 #74

Closed lszeremeta closed 4 months ago

lszeremeta commented 4 months ago

Hi, I noticed that Python 3.12 shows SyntaxWarning: invalid escape sequence '\s' for runguard_config = re.sub("#define\s+VALID_USERS[^\n]+", '#define VALID_USERS "' + runguard_valid_users + '"', runguard_config) in install script. I fixed it to avoid possible problems in the future.

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

https://docs.python.org/dev/whatsnew/3.12.html#other-language-changes

trampgeek commented 4 months ago

Thanks @lszeremeta.