Skip to content

readFromStream(stream, pdf) receives None and pdf.strict fails #81

@emelenas

Description

@emelenas

As stated in the title, pdf.strict in DictionaryObject.readFromStream (at line 667 in generic.py) raises an AttributeError because the parameter pdf as received is None.

Going back, this comes from ContentStream.__parseContentStream at file generic.py line 1027 though the call operands.append(readObject(stream, None)). readObject in turn calls DictionaryObject.readFromStream at line 65 of generic.py

Thus, it is an explicit call with None as an argument that causes the exception.

Anyhow if None is to be passed as argument pdf, I believe a check should be in order down the line to avoid exceptions.

I changed the call to

operands.append(readObject(stream, self.pdf))

and apparently no harm is done (aside from avoiding the exception).

Copied from py-pdf#563 since apparently no development there

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions