[issue39750] UnicodeError becomes unpicklable if data is appended to args

2020-03-01 Thread João Eiras
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

[issue39750] UnicodeError becomes unpicklable if data is appended to args

2020-02-26 Thread João Eiras
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

[issue39750] UnicodeError becomes unpicklable if data is appended to args

2020-02-25 Thread Serhiy Storchaka
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 _

[issue39750] UnicodeError becomes unpicklable if data is appended to args

2020-02-25 Thread João Eiras
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