mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 07:02: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
55dc131944
commit
58e551cc73
@ -1894,6 +1894,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