Skip to content

Commit 695a94c

Browse files
committed
Fix QueueGenerator GIL deadlock in search APIs.
1 parent 770e9c0 commit 695a94c

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

python/binaryview.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9530,11 +9530,14 @@ def __iter__(self):
95309530

95319531
def __next__(self):
95329532
while True:
9533-
if not self.results.empty():
9534-
return self.results.get()
9535-
9536-
if (not self.thread.is_alive()) and self.results.empty():
9537-
raise StopIteration
9533+
try:
9534+
return self.results.get(timeout=0.1)
9535+
except queue.Empty:
9536+
if not self.thread.is_alive():
9537+
try:
9538+
return self.results.get_nowait()
9539+
except queue.Empty:
9540+
raise StopIteration
95389541

95399542
@overload
95409543
def find_all_data(

0 commit comments

Comments
 (0)