New submission from Akuli:
Example:
class BrokenMapping:
def __getitem__(self, key):
1/0
# this silences the ZeroDivisionError and raises KeyError('world')
'hello {world}'.format_map(BrokenMapping())
I have tried this on several different CPython versions on Ubuntu 14.04
(including the latest Python 3.7.0a0 from github) and they all do this.
PyPy passes the ZeroDivisionError through correctly.
----------
messages: 298747
nosy: Akuli
priority: normal
severity: normal
status: open
title: str.format_map() silences exceptions in __getitem__
type: behavior
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue30978>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com