Skip to content

Commit

Permalink
Merge pull request #869 from asottile/py2-invalid-escapes
Browse files Browse the repository at this point in the history
remove python 2 notes about invalid escapes
  • Loading branch information
asottile committed Jul 31, 2023
2 parents b3e813e + 3e27cab commit e982da9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ Availability:
# this fixes a syntax error in python3.3+
-'\N'
+r'\N'

# note: pyupgrade is timid in one case (that's usually a mistake)
# in python2.x `'\u2603'` is the same as `'\\u2603'` without `unicode_literals`
# but in python3.x, that's our friend ☃
```

### `is` / `is not` comparison to constant literals
Expand Down
7 changes: 2 additions & 5 deletions tests/features/escape_sequences_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@
(
'""',
r'r"\d"', r"r'\d'", r'r"""\d"""', r"r'''\d'''",
# python2 has a bug where `rb'foo'` is tokenized as NAME + STRING
r'rb"\d"',
# make sure we don't replace an already valid string
r'"\\d"',
# in python2 `'\u2603'` is literally \\u2603, but transforming based
# on that would be incorrect in python3.
# intentionally timid here to avoid breaking working python3 code
'"\\u2603"',
# this is already a proper unicode escape
r'"\u2603"',
# don't touch already valid escapes
r'"\r\n"',
# python3.3+ named unicode escapes
Expand Down

0 comments on commit e982da9

Please sign in to comment.