João Eiras added the comment:
On a related note, after inspecting the UnicodeEror C code, the exception
object keeps explicit references to 'encoding', 'object', 'start', 'end' and
'reason'. That means that if those properties are set (the C code does have
setters) then the properties stored
João Eiras added the comment:
Hi.
It's perfectly fine for classes to have their public APIs and intended uses.
But then unpickling would be the worst place to complain, specially when
running 40 parallel processes while an unhandled stacktrace appears between a
couple hundred thousand lines o
Serhiy Storchaka added the comment:
Yes, this is how exceptions are pickled. You save an information which which
allows you to recreate the exception. If you fake args, you do not able to
recreate it.
Just do not do this.
--
nosy: +serhiy.storchaka
_
New submission from João Eiras :
Given some exception `ex`, you can append data like
ex.args += (value1, value2, ...)
and then re-raise.
This is something I do in my projects to sometime propagate context when errors
are raised, e.g., stacktraces across process boundaries or blobs of text wit