We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
SearchEngine.search
1 parent b8fa12f commit 9187508Copy full SHA for 9187508
1 file changed
webscrapbook/scrapbook/search.py
@@ -522,14 +522,22 @@ def run(self):
522
def search(self):
523
results = self.search_books()
524
limit = self.query.limit
525
+
526
if limit >= 0:
527
i = 0
528
for item in results:
529
i += 1
530
if i > limit:
531
break
532
yield item
533
534
+ # In some Python implementation (e.g. PyPy with Python 3.11)
535
+ # returning from this function doesn't close results automatically,
536
+ # causing the acquired lock not released.
537
+ results.close()
538
539
return
540
541
yield from results
542
543
def search_books(self):
0 commit comments