PyErr_Fetch
doesn't always return a triplet where the second argument is a PyException
so, to ease the parsing, you might want to use PyErr_NormalizeException
to sort that part out (see the documentation)
What the documentation doesn't say, however, is how normalize exception treats the original results of PyErr_Fetch
in terms of memory retention when it creates the new exception instance.
Can I assume that whatever PyErr_NormalizeException
does to the pointers of PyErr_Fetch
I can PyErr_Restore
them and be "ok" as far as memory is concerned?
I would say that this is the case, but maybe I'm missing a detail and I need to "do something" to the original fetch results instead.
Thank you!