Skip to content

Calling the next attribute of an Annot raises a "No attribute .parent" warning #3131

Closed
@jn-chrn

Description

@jn-chrn

Description of the bug

When reading annotations from a PDF page, we sometimes need the next attribute of Annot. However, when using this attribute, the following message appears in the terminal:

No attribute .parent: type(self)=<class 'fitz.Annot'> id(self)=139712888949840: have set id(self.parent)=139712932742416.

This occurs in version 1.23.21, but not in version 1.22.5.

The object itself seems to be accessible.

How to reproduce the bug

Using the following code returns the warning above when running it:

import fitz

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

PyMuPDF version

1.23.21

Operating system

Linux

Python version

3.11

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions