From 625e0629e2f17967f470743da8d4fa820070448c Mon Sep 17 00:00:00 2001 From: Matthieu Dorier Date: Mon, 28 Nov 2022 10:03:49 +0000 Subject: [PATCH] fixed segfault caused by GIL not acquired when default-initializing bytes object --- pymargo/src/pymargo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymargo/src/pymargo.cpp b/pymargo/src/pymargo.cpp index 0ef860b..12bb67d 100644 --- a/pymargo/src/pymargo.cpp +++ b/pymargo/src/pymargo.cpp @@ -179,6 +179,7 @@ static hg_return_t pymargo_generic_rpc_callback(hg_handle_t handle) hg_return_t ret = HG_SUCCESS; margo_instance_id mid = MARGO_INSTANCE_NULL; const struct hg_info* info = NULL; + py11::gil_scoped_acquire acquire; py11::bytes input; mid = margo_hg_handle_get_instance(handle); @@ -207,7 +208,6 @@ static hg_return_t pymargo_generic_rpc_callback(hg_handle_t handle) if(!disabled_flag) { std::string out; - py11::gil_scoped_acquire acquire; try { pymargo_hg_handle pyhandle(handle); margo_ref_incr(handle);