[3.6] bpo-23894: Make rb'' strings work in lib2to3 (GH-1724)#1730
Merged
ambv merged 1 commit intopython:3.6from May 22, 2017
Merged
[3.6] bpo-23894: Make rb'' strings work in lib2to3 (GH-1724)#1730ambv merged 1 commit intopython:3.6from
ambv merged 1 commit intopython:3.6from
Conversation
This partially solves bpo-23894. (cherry picked from commit 0c4aca5)
ericvsmith
approved these changes
May 22, 2017
| "bR'", 'bR"', "BR'", 'BR"', ): | ||
| "bR'", 'bR"', "BR'", 'BR"', | ||
| "rb'", 'rb"', "Rb'", 'Rb"', | ||
| "rB'", 'rB"', "RB'", 'RB"',): |
Member
There was a problem hiding this comment.
_all_string_prefixes in Lib/tokenize.py computes similar prefixes (without ' or "), but generates it programatically. It's less error prone than listing these prefixes by hand. Plus, if "f" strings are added, the numbers go up dramatically.
You can't use it directly, because it doesn't support "ur" and variants, because they're not supported in 3.x. But maybe you can use a similar strategy.
This isn't a blocker.
Contributor
Author
There was a problem hiding this comment.
I agree this is not elegant. Sadly, the list is not exhaustive as the _litprefix regex shows. So the algorithm would need to be custom anyway. I'd count this as a possible future improvement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This partially solves bpo-23894.
(cherry picked from commit 0c4aca5)