sublime-text-git icon indicating copy to clipboard operation
sublime-text-git copied to clipboard

git/add.py line 61 and git/annotate.py line 88: invalid escape sequence \+ in regex strings (SyntaxWarning on Python 3.12+)

Open dpc00 opened this issue 1 month ago • 0 comments

Claude reports: on Sublime Text 4 build 4215 with the Python 3.14 plugin host, loading the plugin prints two SyntaxWarning messages in the console, both invalid escape sequence:

git/add.py:61:       matcher = re.compile('^@@ -([0-9]*)(?:,([0-9]*))? \+([0-9]*)(?:,([0-9]*))? @@')
git/annotate.py:88:  matcher = re.compile('^@@ -([0-9]*),([0-9]*) \+([0-9]*),([0-9]*) @@')

\+ is a regex escape, not a Python string escape. Python 3.12 and later warn about it, and a later version will make it a SyntaxError, which would stop the plugin loading. Making the two patterns raw strings (an r prefix) fixes it without changing what they match.

Checked: installed through the Package Control picker, removed again afterwards. The plugin loaded, and Git: Log All run from an unsaved buffer (no repository) ended without an error or a dialog.

dpc00 avatar Oct 30 '26 09:10 dpc00