Skip to content

Python: escape doc strings or make them raw strings to avoid "SyntaxWarning: invalid escape sequence" on Python 3.12 #1226

Open
@armijnhemel

Description

@armijnhemel

Since Python 3.12 invalid escape sequences give a SyntaxWarning instead of a DeprecationWarning (see python/cpython#98401 ). In the future these will likely be treated as errors.

Kaitai Struct does not properly escape doc strings, which gives a syntax warning:

$ pylint android_bootldr_qcom.py
<unknown>:12: SyntaxWarning: invalid escape sequence '\['
<unknown>:12: SyntaxWarning: invalid escape sequence '\['
...

The easy fix is to make doc strings raw strings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions