Skip to content

Conversation

@ambv
Copy link
Contributor

@ambvambv commented May 22, 2017

This partially solves bpo-23894.
(cherry picked from commit 0c4aca5)

This partially solves bpo-23894. (cherry picked from commit 0c4aca5)
@ambvambv changed the title [3.6] Make rb'' strings work in lib2to3 (GH-1724)[3.6] bpo-23894: Make rb'' strings work in lib2to3 (GH-1724)May 22, 2017
@ambvambv requested a review from ericvsmithMay 22, 2017 22:58
"bR'", 'bR"', "BR'", 'BR"', ):
"bR'", 'bR"', "BR'", 'BR"',
"rb'", 'rb"', "Rb'", 'Rb"',
"rB'", 'rB"', "RB'", 'RB"',):
Copy link
Member

@ericvsmithericvsmithMay 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_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.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ambvambv merged commit 1398b1b into python:3.6May 22, 2017
@ambvambv deleted the backport-0c4aca5-3.6 branch July 12, 2021 11:21
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@ambv@ericvsmith@the-knights-who-say-ni