Commit 58e551cc authored by Antony Lee's avatar Antony Lee Committed by Jason Rhinelander
Browse files

Properly report exceptions thrown during module initialization.

If an exception is thrown during module initialization, the
error_already_set destructor will try to call `get_internals()` *after*
setting Python's error indicator, resulting in a `SystemError: ...
returned with an error set`.

Fix that by temporarily stashing away the error indicator in the
destructor.
parent 55dc1319
......@@ -1894,6 +1894,7 @@ class gil_scoped_release { };
error_already_set::~error_already_set() {
if (type) {
error_scope scope;
gil_scoped_acquire gil;
type.release().dec_ref();
value.release().dec_ref();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment