Skip to content

Commit

Permalink
Document.close(): set .is_closed to true.
Browse files Browse the repository at this point in the history
Added a test of this to tests/test_general.py:test_bug1971().

This addresses #3039.
  • Loading branch information
julian-smith-artifex-com committed Jan 15, 2024
1 parent a4ace1e commit efda39e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3560,16 +3560,12 @@ def close(self):
#self._reset_page_refs()
#self.metadata = None
#self.stream = None
#self.is_closed = True
self.is_closed = True
#self.FontInfos = []
#self.Graftmaps = {}
#self.ShownPages = {}
#self.InsertedImages = {}

#self.this = None
self.close_internal()

def close_internal(self):
self.this = None

def convert_to_pdf(self, from_page=0, to_page=-1, rotate=0):
Expand Down
1 change: 1 addition & 0 deletions tests/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def test_bug1971():
page = next(doc.pages())
page.get_drawings()
doc.close()
assert doc.is_closed

def test_default_font():
f = fitz.Font()
Expand Down

0 comments on commit efda39e

Please sign in to comment.