Repository navigation
Fix BaseSerialization double-wrapping args for builtin exceptions - #69752
bujjibabukatta wants to merge 1 commit into
Conversation
|
Hi @bujjibabukatta, thanks for the contribution! I'm a bit concerned this might introduce a regression. Could you please double-check to ensure this change won't break existing behavior? Thanks! |
821e847 to
d238824
Compare
|
Hi @nailo2c |
|
This pull request has been automatically marked as stale because the author has not responded to a request for more information. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
|
This pull request has been closed because the author has not responded to a request for more information. |
Ran into this from #69743 —
BaseSerializationwas manglingargsforbuilt-in exceptions like
KeyErroron the round trip.Turns out the exception-serialization branch for
KeyError/AttributeErrorwas storing
argsas[var.args]. Sincevar.argsis already a tuple(e.g.
("boom",)), that wraps it in an extra layer. When deserializing,exc_cls(*args)unpacks that as a single positional arg — so you getKeyError(("boom",))instead ofKeyError("boom"), and.argscomes backas
(("boom",),)instead of("boom",).Fix is a one-liner: store
list(var.args)instead of[var.args]so itstays flat.
Added a parametrized test covering single-arg, multi-arg, and no-arg
KeyError/AttributeErrorround-trips so this doesn't regress.closes: #69743
AI Disclosure
Model(s) used: Codex (GPT-5.5) Following by the guidelines
AI was used for:
The implementation and code changes were developed and validated by me.