Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-32157: Remove explicit quotes around %r and {!r}. #4582

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Nov 27, 2017

@serhiy-storchaka serhiy-storchaka requested review from rhettinger and a team as code owners November 27, 2017 08:47
@serhiy-storchaka serhiy-storchaka changed the title Remove explicit quotes around %r and {!r}. bpo-32157: Remove explicit quotes around %r and {!r}. Nov 28, 2017
Copy link
Member

@ericvsmith ericvsmith left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@@ -1166,7 +1166,7 @@ def _match(self, cre, s):
self.mo = cre.match(s)
if __debug__:
if self.mo is not None and self.debug >= 5:
self._mesg("\tmatched r'%r' => %r" % (cre.pattern, self.mo.groups()))
self._mesg("\tmatched %r => %r" % (cre.pattern, self.mo.groups()))
Copy link
Member

Choose a reason for hiding this comment

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

I think what this actually wanted to be was r'%s' % cre.pattern.replace('\\\\', '\\'), but of course that doesn't work in all cases. It would be nice if we had a codec that produced raw string representation (it would have to fall back to repr for cases that can't be represented as raw strings).

Copy link
Member Author

Choose a reason for hiding this comment

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

I will think about it.

@serhiy-storchaka serhiy-storchaka merged commit a4a3020 into python:master Nov 28, 2017
@serhiy-storchaka serhiy-storchaka deleted the redundant-repr-quotes branch November 28, 2017 20:54
@serhiy-storchaka
Copy link
Member Author

Thank you all!

Initially I was going to backport this change to 3.6 and 2.7, but now I am not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants