From 8f1537468a7e5f5a526ddf1e9c634740c923404b Mon Sep 17 00:00:00 2001 From: Lubo Slivka Date: Thu, 8 Feb 2024 22:58:07 +0100 Subject: [PATCH] GH-40004: [Python][FlightRPC] Release GIL in GeneratorStream (#40005) Fixes #40004. * Closes: #40004 Authored-by: lupko Signed-off-by: David Li --- python/pyarrow/_flight.pyx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/pyarrow/_flight.pyx b/python/pyarrow/_flight.pyx index a2ff045f256ac..67ee7590560f0 100644 --- a/python/pyarrow/_flight.pyx +++ b/python/pyarrow/_flight.pyx @@ -2013,8 +2013,9 @@ cdef CStatus _data_stream_next(void* self, CFlightPayload* payload) except *: max_attempts = 128 for _ in range(max_attempts): if stream.current_stream != nullptr: - check_flight_status( - stream.current_stream.get().Next().Value(payload)) + with nogil: + check_flight_status( + stream.current_stream.get().Next().Value(payload)) # If the stream ended, see if there's another stream from the # generator if payload.ipc_message.metadata != nullptr: