mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-24 14:15:11 +00:00
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.
This commit is contained in:
parent
d3908be61d
commit
c9ee873a53
@ -1867,6 +1867,7 @@ class gil_scoped_release { };
|
|||||||
|
|
||||||
error_already_set::~error_already_set() {
|
error_already_set::~error_already_set() {
|
||||||
if (type) {
|
if (type) {
|
||||||
|
error_scope scope;
|
||||||
gil_scoped_acquire gil;
|
gil_scoped_acquire gil;
|
||||||
type.release().dec_ref();
|
type.release().dec_ref();
|
||||||
value.release().dec_ref();
|
value.release().dec_ref();
|
||||||
|
Loading…
Reference in New Issue
Block a user