-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
bpo-29104: Fixed parsing backslashes in f-strings. #490
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-29104: Fixed parsing backslashes in f-strings. #490
Conversation
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.
Other than my one comment, this looks good to me. Thanks!
Lib/test/test_fstring.py
Outdated
self.assertEqual(f'\\{6*7}', '\\42') | ||
self.assertEqual(fr'\{6*7}', '\\42') | ||
|
||
AMPERSAND = 123 |
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.
It took me literally an hour to figure out what's going on here.
Can you change this line to something:
AMPERSAND = ord('{') # =123: Make sure we get the right unicode character (&), and not pick up local variable
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.
The value is arbitrary. I didn't meant ord('{')
.
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.
Right. But the important part (to me) that I missed is that it's not equal to ord('&')
. I had assumed it was, and that somehow that value was being used to produce the '&' in the output. But the point is that the value of the local AMPERSAND
is not being used, correct?
If so, how about using 0, since most people by inspection know it's not an &
?
(cherry picked from commit 0cd7a3f)
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 2.12.1 to 3.0.0. - [Release notes](https://github.com/pytest-dev/pytest-cov/releases) - [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst) - [Commits](pytest-dev/pytest-cov@v2.12.1...v3.0.0) --- updated-dependencies: - dependency-name: pytest-cov dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
No description provided.