We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0ef81c3 commit 1f3b8a8Copy full SHA for 1f3b8a8
1 file changed
src/PIL/PdfParser.py
@@ -383,7 +383,7 @@ def __init__(
383
msg = "specify buf or f or filename, but not both buf and f"
384
raise RuntimeError(msg)
385
self.filename = filename
386
- self.buf: bytes | bytearray | mmap.mmap | None = buf
+ self.buf: bytes | bytearray | memoryview | mmap.mmap | None = buf
387
self.f = f
388
self.start_offset = start_offset
389
self.should_close_buf = False
@@ -435,7 +435,9 @@ def start_writing(self) -> None:
435
self.seek_end()
436
437
def close_buf(self) -> None:
438
- if isinstance(self.buf, mmap.mmap):
+ if isinstance(self.buf, memoryview):
439
+ self.buf.release()
440
+ elif isinstance(self.buf, mmap.mmap):
441
self.buf.close()
442
self.buf = None
443
0 commit comments