GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [3.6] bpo-23894: Make rb'' strings work in lib2to3 (GH-1724) by ambv · Pull Request #1730 · python/cpython

Conversation

@ambv

@ambv ambv commented May 22, 2017

Copy link
Copy Markdown
Contributor

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ambv Lukasz Langa
[3.6] Make rb'' strings work in lib2to3 (pythonGH-1724)
b2c5e99
This partially solves bpo-23894.
(cherry picked from commit 0c4aca5)
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label May 22, 2017
@ambv ambv 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
@ambv
ambv requested a review from ericvsmith May 22, 2017 22:58
ericvsmith
ericvsmith approved these changes May 22, 2017
View reviewed changes
Comment thread Lib/lib2to3/pgen2/tokenize.py
"bR'", 'bR"', "BR'", 'BR"', ):
"bR'", 'bR"', "BR'", 'BR"',
"rb'", 'rb"', "Rb'", 'Rb"',
"rB'", 'rB"', "RB'", 'RB"',):

@ericvsmith ericvsmith May 22, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ambv ambv May 22, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@ericvsmith ericvsmith ericvsmith approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@ambv @ericvsmith @the-knights-who-say-ni
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.