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-30978: str.format_map() now passes key lookup exceptions through. #2790

Conversation

serhiy-storchaka
Copy link
Member

No description provided.

@mention-bot
Copy link

@serhiy-storchaka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ericvsmith, @pitrou and @doerwalter to be potential reviewers.

@vstinner
Copy link
Member

A test fails:

ERROR: test_match_getitem (test.test_re.ReTests)


Traceback (most recent call last):

File "/home/travis/build/python/cpython/Lib/test/test_re.py", line 472, in test_match_getitem

'a1={a2}'.format_map(m)

IndexError: no such group

You should document this behaviour change in the NEWS entry (and fix the test).

@ericvsmith
Copy link
Member

Other than the failing test in test_re, this looks good to me.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

Thanks, it's now better with NEWS describing the old behaviour ;-)

@@ -1 +1,2 @@
str.format_map() now passes key lookup exceptions through.
Previousle any exception was replaced with a KeyError exception.
Copy link
Member

Choose a reason for hiding this comment

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

Typo: Previousle -> Previously

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks!

@serhiy-storchaka serhiy-storchaka merged commit 5075416 into python:master Aug 3, 2017
@serhiy-storchaka serhiy-storchaka deleted the str-format_map-lookup-exceptions branch August 3, 2017 08:45
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Aug 3, 2017
…rough. (pythonGH-2790)

Previously any exception was replaced with a KeyError exception.
(cherry picked from commit 5075416)
@bedevere-bot
Copy link

GH-2992 is a backport of this pull request to the 3.6 branch.

serhiy-storchaka added a commit that referenced this pull request Aug 3, 2017
…rough. (GH-2790) (#2992)

Previously any exception was replaced with a KeyError exception.
(cherry picked from commit 5075416)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants