diff --git a/python/perspective/perspective/src/view.cpp b/python/perspective/perspective/src/view.cpp index 486566ba88..6d8c504a55 100644 --- a/python/perspective/perspective/src/view.cpp +++ b/python/perspective/perspective/src/view.cpp @@ -412,11 +412,14 @@ namespace binding { std::int32_t end_col, bool compress ) { - PSP_GIL_UNLOCK(); - PSP_READ_LOCK(view->get_lock()); - std::shared_ptr str = view->to_arrow( - start_row, end_row, start_col, end_col, true, compress - ); + std::shared_ptr str; + { + PSP_GIL_UNLOCK(); + PSP_READ_LOCK(view->get_lock()); + str = view->to_arrow( + start_row, end_row, start_col, end_col, true, compress + ); + } return py::bytes(*str); } @@ -429,11 +432,14 @@ namespace binding { std::int32_t end_col, bool compress ) { - PSP_GIL_UNLOCK(); - PSP_READ_LOCK(view->get_lock()); - std::shared_ptr str = view->to_arrow( - start_row, end_row, start_col, end_col, true, compress - ); + std::shared_ptr str; + { + PSP_GIL_UNLOCK(); + PSP_READ_LOCK(view->get_lock()); + str = view->to_arrow( + start_row, end_row, start_col, end_col, true, compress + ); + } return py::bytes(*str); } @@ -446,11 +452,14 @@ namespace binding { std::int32_t end_col, bool compress ) { - PSP_GIL_UNLOCK(); - PSP_READ_LOCK(view->get_lock()); - std::shared_ptr str = view->to_arrow( - start_row, end_row, start_col, end_col, true, compress - ); + std::shared_ptr str; + { + PSP_GIL_UNLOCK(); + PSP_READ_LOCK(view->get_lock()); + str = view->to_arrow( + start_row, end_row, start_col, end_col, true, compress + ); + } return py::bytes(*str); } @@ -463,11 +472,14 @@ namespace binding { std::int32_t end_col, bool compress ) { - PSP_GIL_UNLOCK(); - PSP_READ_LOCK(view->get_lock()); - std::shared_ptr str = view->to_arrow( - start_row, end_row, start_col, end_col, true, compress - ); + std::shared_ptr str; + { + PSP_GIL_UNLOCK(); + PSP_READ_LOCK(view->get_lock()); + str = view->to_arrow( + start_row, end_row, start_col, end_col, true, compress + ); + } return py::bytes(*str); } @@ -530,41 +542,50 @@ namespace binding { py::bytes get_row_delta_unit(std::shared_ptr> view) { - PSP_GIL_UNLOCK(); - PSP_READ_LOCK(view->get_lock()); - std::shared_ptr> slice = view->get_row_delta(); - std::shared_ptr arrow = - view->data_slice_to_arrow(slice, false, false); + std::shared_ptr arrow; + { + PSP_GIL_UNLOCK(); + PSP_READ_LOCK(view->get_lock()); + std::shared_ptr> slice = + view->get_row_delta(); + arrow = view->data_slice_to_arrow(slice, false, false); + } return py::bytes(*arrow); } py::bytes get_row_delta_zero(std::shared_ptr> view) { - PSP_GIL_UNLOCK(); - PSP_READ_LOCK(view->get_lock()); - std::shared_ptr> slice = view->get_row_delta(); - std::shared_ptr arrow = - view->data_slice_to_arrow(slice, false, false); + std::shared_ptr arrow; + { + PSP_GIL_UNLOCK(); + PSP_READ_LOCK(view->get_lock()); + std::shared_ptr> slice = view->get_row_delta(); + arrow = view->data_slice_to_arrow(slice, false, false); + } return py::bytes(*arrow); } py::bytes get_row_delta_one(std::shared_ptr> view) { - PSP_GIL_UNLOCK(); - PSP_READ_LOCK(view->get_lock()); - std::shared_ptr> slice = view->get_row_delta(); - std::shared_ptr arrow = - view->data_slice_to_arrow(slice, false, false); + std::shared_ptr arrow; + { + PSP_GIL_UNLOCK(); + PSP_READ_LOCK(view->get_lock()); + std::shared_ptr> slice = view->get_row_delta(); + arrow = view->data_slice_to_arrow(slice, false, false); + } return py::bytes(*arrow); } py::bytes get_row_delta_two(std::shared_ptr> view) { - PSP_GIL_UNLOCK(); - PSP_READ_LOCK(view->get_lock()); - std::shared_ptr> slice = view->get_row_delta(); - std::shared_ptr arrow = - view->data_slice_to_arrow(slice, false, false); + std::shared_ptr arrow; + { + PSP_GIL_UNLOCK(); + PSP_READ_LOCK(view->get_lock()); + std::shared_ptr> slice = view->get_row_delta(); + arrow = view->data_slice_to_arrow(slice, false, false); + } return py::bytes(*arrow); }