Commits

Anonymous committed c5aa9da

multiproc: make sure .doclist tempfile gets closed

  • Participants
  • Parent commits 814e913
  • Branches 2.4x

Comments (0)

Files changed (1)

File 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()