Skip to content

Commit

Permalink
Raw strings for RE_BINARY_DIFF
Browse files Browse the repository at this point in the history
`\s` isn't a valid backslash escape for a normal Python escape, which ends up
"working" since the `\s` gets preserved verbatim.

However, the invalid backslash escape can break other tools that process Python
source code, notably `pytest`s assertion rewriting.
  • Loading branch information
rraval authored Feb 1, 2022
1 parent 68e0fa5 commit 976066a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions unidiff/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@

RE_BINARY_DIFF = re.compile(
r'^Binary files? '
'(?P<source_filename>[^\t]+?)(?:\t(?P<source_timestamp>[\s0-9:\+-]+))?'
'(?: and (?P<target_filename>[^\t]+?)(?:\t(?P<target_timestamp>[\s0-9:\+-]+))?)? (differ|has changed)')
r'(?P<source_filename>[^\t]+?)(?:\t(?P<source_timestamp>[\s0-9:\+-]+))?'
r'(?: and (?P<target_filename>[^\t]+?)(?:\t(?P<target_timestamp>[\s0-9:\+-]+))?)? (differ|has changed)')

DEFAULT_ENCODING = 'UTF-8'

Expand Down

0 comments on commit 976066a

Please sign in to comment.