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

davidism opened this issue Apr 8, 2017 · 1 comment


Copy link

@davidism davidism 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
Copy link

@untitaker untitaker 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
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants