Skip to content

CI: make lint:python check for invalid escape sequences in Python strings

Description

The lint:python CI job currently spits out lots of SyntaxWarning: invalid escape sequence messages. This seems to be because flake8 imports/parses Python code using Python itself, and since Python 3.12 invalid escape sequences now generate a SyntaxWarning, these messages show up even though flake8 itself is not checking for invalid escape sequences. These messages flood the CI job log and make it hard to see what the actual lint errors are.

The solution is to get flake8 to check for invalid escape sequences itself (the code is W605) and actually fix the invalid escape sequences in the flagged Python code.

API Changes and Justification

Backwards Compatible Changes

  • This change does not modify any class/function/struct/type definitions in a public C header file or any Python class/function definitions
  • This change adds new classes/functions/structs/types to a public C header file or Python module

Backwards Incompatible Changes

  • This change modifies an existing class/function/struct/type definition in a public C header file or Python module
  • This change removes an existing class/function/struct/type from a public C header file or Python module

Review Status

n/a

Merge request reports