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

TypeConversionDict should not return default for KeyError during conversion #1102

Closed
davidism opened this issue Apr 8, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@davidism
Copy link
Member

commented Apr 8, 2017

From #1078. If the conversion function raises a KeyError, that should be propagated instead of returning the default.

switch = {'a': 1}
data = TypeConversionDict(good='a', bad='b')
out = data.get('good', 'default', lambda v: switch[v])
assert out == 1
out = data.get('bad', 'default', lambda v: switch[v])
assert out != 'default' # shouldn't get here, should propagate KeyError from converter
@untitaker

This comment has been minimized.

Copy link
Member

commented Apr 15, 2017

Let's keep this out of the maintenance branch since the bugfix isn't critical but potentially breaks code.

@davidism davidism added this to the 0.13 milestone Dec 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.