[issue30978] str.format_map() silences exceptions in __getitem__

2017-08-03 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue30978] str.format_map() silences exceptions in __getitem__

2017-08-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset f08b2be4416163e3d18b8d09891e7cda0d8a21d4 by Serhiy Storchaka in branch '3.6': [3.6] bpo-30978: str.format_map() now passes key lookup exceptions through. (GH-2790) (#2992)

[issue30978] str.format_map() silences exceptions in __getitem__

2017-08-03 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +3031 ___ Python tracker ___ ___

[issue30978] str.format_map() silences exceptions in __getitem__

2017-08-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 5075416b8fedc5526b643dabc915f7945fa0d969 by Serhiy Storchaka in branch 'master': bpo-30978: str.format_map() now passes key lookup exceptions through. (#2790) https://github.com/python/cpython/commit/5075416b8fedc5526b643dabc915f7945fa0d969

[issue30978] str.format_map() silences exceptions in __getitem__

2017-07-21 Thread Brett Cannon
Brett Cannon added the comment: I'm -0 on the backport since as Raymond and Eric pointed out it won't benefit currently working code and I personally don't like changing what exception is raised in a bugfix release. -- nosy: +brett.cannon ___

[issue30978] str.format_map() silences exceptions in __getitem__

2017-07-21 Thread Akuli
Akuli added the comment: Oops, I forgot to mention that I have no thoughts about backporting this. It would be nice to see this fixed in 3.7 though :) -- ___ Python tracker

[issue30978] str.format_map() silences exceptions in __getitem__

2017-07-21 Thread Akuli
Akuli added the comment: I think all exceptions should be passed through. Things like dict.__contains__ don't selectively turn some errors to KeyError either; if something is not hashable it's a TypeError, not a KeyError. >>> [] in {} Traceback (most recent call last): File "",

[issue30978] str.format_map() silences exceptions in __getitem__

2017-07-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: > What are your thoughts about backporting this Raymond? +0 On the one hand, this can be considered a bug fix. On the other hand, I would suspect that no code that is currently working would benefit. -- ___

[issue30978] str.format_map() silences exceptions in __getitem__

2017-07-21 Thread STINNER Victor
STINNER Victor added the comment: For Python 3.5 and 3.6, would it make sense to modify the code to pass though BaseException, but replace all other exceptions with KeyError? It would be a compromise between doing nothing and fixing the bug :-) --

[issue30978] str.format_map() silences exceptions in __getitem__

2017-07-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What are your thoughts about backporting this Raymond? -- nosy: +rhettinger ___ Python tracker ___

[issue30978] str.format_map() silences exceptions in __getitem__

2017-07-21 Thread Eric V. Smith
Eric V. Smith added the comment: I'm -0 on a backport. The new behavior is more correct, but I don't like changing the exception type in a micro release. -- ___ Python tracker

[issue30978] str.format_map() silences exceptions in __getitem__

2017-07-21 Thread STINNER Victor
STINNER Victor added the comment: While KeyboardInterrupt and ZeroDivisionError are easy to understand, IndexError converted to KeyError doesn't look like a major bug. So I'm not sure about fixing Python 3.5 and 3.6. Maybe it's ok because this function is rarely used and exceptions are not

[issue30978] str.format_map() silences exceptions in __getitem__

2017-07-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yet one consequence: this swallows KeyboardInterrupt and converts it to KeyError. -- components: +Interpreter Core, Unicode nosy: +ezio.melotti, haypo, serhiy.storchaka stage: -> patch review versions: +Python 3.6 -Python 3.3, Python 3.4

[issue30978] str.format_map() silences exceptions in __getitem__

2017-07-20 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +2840 ___ Python tracker ___ ___

[issue30978] str.format_map() silences exceptions in __getitem__

2017-07-20 Thread Eric V. Smith
Changes by Eric V. Smith : -- nosy: +eric.smith ___ Python tracker ___ ___

[issue30978] str.format_map() silences exceptions in __getitem__

2017-07-20 Thread Akuli
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