Hello Andreas, On 13/02/2024 18:21, Andreas Tille wrote:
I was constantly shaking my had above bug #1061802 featuring Syntaxwarnings likeSyntaxWarning: invalid escape sequence '\.' 573s CLI_INPUT_RE = re.compile('[a-zA-Z0-9_:\.\-\+; /#%]') 573s /tmp/autopkgtest.G4v4eK/autopkgtest_tmp/hatop.py:215: SyntaxWarning: invalid escape sequence '\s' 573s 'software_name': re.compile('^Name:\s*(?P<value>\S+)'),
Python 3.12 added some SyntaxWarning when there is invalid sequences in a string. (If I remember correctly, it has already happened in the past.) It's a warning so the code should work properly.
If a string contains 'invalid sequences' (like regexp), you can declare it as raw string: they are prefixed with an 'r' character.
The source code should be: 'software_name': re.compile(r'^Name:\s*(?P<value>\S+)'), The fix comes from the second point in: https://docs.python.org/3/whatsnew/3.12.html#other-language-changes -- Stéphane
OpenPGP_signature.asc
Description: OpenPGP digital signature