gh-145876: Do not mask AttributeErrors raised during dictionary unpacking#145906
Conversation
… unpacking
AttributeErrors raised in keys() or __getitem__() during
dictionary unpacking ({**mymapping} or func(**mymapping)) are
no longer masked by TypeError.
NickCrews
left a comment
There was a problem hiding this comment.
The tests look good to me, modulo my question about checking for error chaining.
I wanted to point out non-atomic way we are checking for the presence of .keys(). But I'm guessing you had reasons you weren't doing something else.
Thanks for your work here!
Sorry, something went wrong.
|
Thanks for the responses to my review @serhiy-storchaka. It looks like you already considered all the potential concerns I raised, and you know better than me the pros/cons of the solutions. So this looks good to me! Is there anything I can do to help move this forward? Would a benchmark be useful to verify this doesn't hurt performance too much? Should I do that by adding a test case to the pyperformance repo, similar to this PR from 2 months ago? |
Sorry, something went wrong.
|
Nothing. I only waited if there are any suggestions or objections. |
Sorry, something went wrong.
0e54305
into
python:main
Mar 26, 2026
|
Thank you! |
Sorry, something went wrong.
… unpacking (pythonGH-145906) AttributeErrors raised in keys() or __getitem__() during dictionary unpacking ({**mymapping} or func(**mymapping)) are no longer masked by TypeError.
… unpacking (pythonGH-145906) AttributeErrors raised in keys() or __getitem__() during dictionary unpacking ({**mymapping} or func(**mymapping)) are no longer masked by TypeError.
AttributeErrors raised in
keys()or__getitem__()during dictionary unpacking ({**mymapping}orfunc(**mymapping)) are no longer masked by TypeError..keys()or.__getitem__()during{**mymapping}are incorrectly masked #145876