mirror of
https://github.com/RYDE-WORK/pybind11.git
synced 2026-02-05 23:13:36 +08: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…
x
Reference in New Issue
Block a user