Skip to content

Python: Fix r"\\" and derivatives

Jan Paul Batrina requested to merge work/python-raw-double-backslash into master

In such cases, the last \ should not be interpreted as a line continuation escape.

This regression was introduced by 14c8f976 and made more obvious by 90f56236.

New regression tests are added for most variants, e.g. rb"""\\"""

BUG: 440412

kate-double-backslash-python

The correct highlighting should be:

a = r"\\" \
rb'\\' \
rf"""\\""" \
ur'''\\'''
def should_not_be_inside_string():
    print('''test''' + """string""")
Edited by Jan Paul Batrina

Merge request reports

Loading