Skip to content

Commit

Permalink
Annot.get_parent(): disable spurious diagnostic.
Browse files Browse the repository at this point in the history
Addresses pymupdf#3131.
  • Loading branch information
julian-smith-artifex-com committed Feb 10, 2024
1 parent 7187067 commit 42cfd5f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ def get_parent(self):
ret = Page(page, document)
#self.parent = weakref.proxy( ret)
self.parent = ret
print(f'No attribute .parent: {type(self)=} {id(self)=}: have set {id(self.parent)=}.')
#print(f'No attribute .parent: {type(self)=} {id(self)=}: have set {id(self.parent)=}.')
#print( f'Have set self.parent')
return ret

Expand Down
12 changes: 12 additions & 0 deletions tests/test_annots.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,15 @@ def test_file_info():
{'filename': 'example.pdf', 'descender': '', 'length': 8416, 'size': 8992},
{'filename': 'photo1.jpeg', 'descender': '', 'length': 10154, 'size': 8012},
]

def test_3131():
doc = fitz.open()
page = doc.new_page()

page.add_line_annot((0, 0), (1, 1))
page.add_line_annot((1, 0), (0, 1))

first_annot, _ = page.annots()
first_annot.next.type


0 comments on commit 42cfd5f

Please sign in to comment.