Commits

Anonymous committed c5aa9da

multiproc: make sure .doclist tempfile gets closed

Comments (0)

Files changed (1)

src/whoosh/filedb/multiproc.py

         dump = pickle.dump
         length = len(docbuffer)
         fd, filename = tempfile.mkstemp(".doclist")
-        f = os.fdopen(fd, "wb")
-        for item in docbuffer:
-            dump(item, f, -1)
+        with os.fdopen(fd, "wb") as f:
+            for item in docbuffer:
+                dump(item, f, -1)
 
         if len(self.tasks) < self.procs:
             self._new_task()