mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
fix: ensure the GIL is held when copying a function. (#2545)
Co-authored-by: Hyrum Wright <hwright@google.com>
This commit is contained in:
parent
1bcd5f0a19
commit
961b2e6205
@ -58,7 +58,10 @@ public:
|
||||
struct func_handle {
|
||||
function f;
|
||||
func_handle(function&& f_) : f(std::move(f_)) {}
|
||||
func_handle(const func_handle&) = default;
|
||||
func_handle(const func_handle& f_) {
|
||||
gil_scoped_acquire acq;
|
||||
f = f_.f;
|
||||
}
|
||||
~func_handle() {
|
||||
gil_scoped_acquire acq;
|
||||
function kill_f(std::move(f));
|
||||
|
Loading…
Reference in New Issue
Block a user