Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: 6820004b3e2b6997b8ad8663c548fb3da2fcb3b2
      
https://github.com/tianocore/edk2/commit/6820004b3e2b6997b8ad8663c548fb3da2fcb3b2
  Author: Mike Beaton <mjsbea...@gmail.com>
  Date:   2024-09-23 (Mon, 23 Sep 2024)

  Changed paths:
    M BaseTools/Source/Python/Ecc/Check.py
    M BaseTools/Source/Python/Ecc/Configuration.py
    M BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
    M BaseTools/Source/Python/Ecc/c.py
    M BaseTools/Source/Python/Eot/EotGlobalData.py
    M BaseTools/Source/Python/Eot/c.py
    M BaseTools/Source/Python/UPT/Library/CommentParsing.py
    M BaseTools/Source/Python/UPT/Library/ExpressionValidate.py
    M BaseTools/Source/Python/UPT/Library/Misc.py
    M BaseTools/Source/Python/UPT/Library/StringUtils.py
    M BaseTools/Source/Python/UPT/Parser/DecParserMisc.py
    M BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py
    M BaseTools/Source/Python/UPT/Parser/InfDefineSectionParser.py
    M BaseTools/Source/Python/UPT/Parser/InfParserMisc.py
    M BaseTools/Source/Python/UPT/PomAdapter/DecPomAlignment.py
    M BaseTools/Source/Python/UPT/Xml/IniToXml.py
    M BaseTools/Source/Python/UPT/Xml/PcdXml.py
    M BaseTools/Source/Python/UPT/Xml/XmlParser.py

  Log Message:
  -----------
  BaseTools: Fix multiple 'invalid escape sequence' warnings in tests

In Python 3.12 invalid escape sequences in strings moved from
DeprecationWarning to SyntaxWarning
(ref https://docs.python.org/3/whatsnew/changelog.html#python-3-12-0-final
and search for gh-98401). In a future Python version this will become
SyntaxError.

Multiple instances of these SyntaxWarnings are currently printed when
running the BaseTools tests using Python 3.12 (though without actually
failing the affected tests).

This commit updates all lines which were causing this type of warning.

Typical examples which needed fixing are:

- "BaseTools\Source\Python" representing a path: "\S" and "\P" are invalid
escape sequences, therefore left unchanged, therefore the test works
(with a warning in Python 3.12). r"BaseTools\Source\Python" represents
the same string, but with escapes turned off completely thus no warning.

- Where '\t\s' is used as a regex pattern, then chr(9) + '\\s' is sent
to the regex parser (with a warning in Python 3.12) since '\s' is not a
valid Python escape sequence. This works correctly, though arguably for
the wrong reasons. r'\t\s' sends the same as '\\t\\s', as originally
intended and with no warning.

(Note that ' and " are not fundamentally different in Python.)

Signed-off-by: Mike Beaton <mjsbea...@gmail.com>



To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to