Skip to content

Commit 2e45bef

Browse files
committed
Add buffer reset to whoosh Bufferfile.close
1 parent 457f61e commit 2e45bef

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/moin/utils/monkeypatch.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright: 2010 MoinMoin:ThomasWaldmann
2+
# Copyright: 2025 MoinMoin Project
23
# License: the individual patches have same license as the code they are patching
34

45
"""
@@ -27,3 +28,19 @@ def log(self, type, message, *args):
2728

2829

2930
werkzeug.serving.WSGIRequestHandler = WSGIRequestHandler
31+
32+
# Whoosh patching ------------------------------------------------------------
33+
34+
# Reset buffer on close
35+
# see github issues #1645 and #1961
36+
37+
from whoosh.filedb.structfile import BufferFile
38+
39+
40+
def buffer_file_close(self):
41+
super(BufferFile, self).close()
42+
self._buf = None
43+
44+
45+
# patch class BufferFile
46+
BufferFile.close = buffer_file_close

0 commit comments

Comments
 (0)