mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
use pybind11::gil_scoped_acquire instead of PyGILState_*
This commit is contained in:
parent
099d6e9c48
commit
8d396fcff2
@ -482,14 +482,7 @@ public:
|
||||
: std::runtime_error(e.what()), type(e.type), value(e.value),
|
||||
trace(e.trace) { e.type = e.value = e.trace = nullptr; }
|
||||
|
||||
~error_already_set() {
|
||||
if (value) {
|
||||
PyGILState_STATE state = PyGILState_Ensure();
|
||||
PyErr_Restore(type, value, trace);
|
||||
PyErr_Clear();
|
||||
PyGILState_Release(state);
|
||||
}
|
||||
}
|
||||
inline ~error_already_set(); // implementation in pybind11.h
|
||||
|
||||
error_already_set& operator=(const error_already_set &) = delete;
|
||||
|
||||
|
@ -1647,6 +1647,14 @@ class gil_scoped_acquire { };
|
||||
class gil_scoped_release { };
|
||||
#endif
|
||||
|
||||
error_already_set::~error_already_set() {
|
||||
if (value) {
|
||||
gil_scoped_acquire gil;
|
||||
PyErr_Restore(type, value, trace);
|
||||
PyErr_Clear();
|
||||
}
|
||||
}
|
||||
|
||||
inline function get_type_overload(const void *this_ptr, const detail::type_info *this_type, const char *name) {
|
||||
handle py_object = detail::get_object_handle(this_ptr, this_type);
|
||||
if (!py_object)
|
||||
|
Loading…
Reference in New Issue
Block a user