Thanks to visit codestin.com
Credit goes to github.com

Skip to content

swig-4.4.0 with PyMuPDF/MuPDF gives Director errors on MacOS only. #3279

@julian-smith-artifex-com

Description

Since swig-4.4.0 was uploaded to pypi.org a few hours ago, PyMuPDF tests have started failing on MacOS x86_64 and arm64.

  • Tests are still passing on Linux and Windows.
  • Tests pass fine on MacOS x86_64 and arm64 if we force the use of swig-4.3.1.

PyMuPDF and MuPDF are quite complicated and i haven't yet created a small reproducer, but i though it was worth creating this issue now because this could be quite a serious regression in swig. (Unless of course it's exposing something wrong in our code.)

For example output see Github workflow results at: https://github.com/pymupdf/PyMuPDF/actions/runs/18866039539/job/53833771115. PyMuPDF/MuPDF

The failures seem to be caused by exceptions in Director callbacks.

First there is:

Director error: <class 'TypeError'>: SWIG director type mismatch in output value of type '::fz_font *'

[fz_font is a C struct in MuPDF, wrapped by SWIG. I don't know what function (that returns a fz_font*) is being called here.]

We have code that prints information about exceptions in Director callbacks, and this seems to be failing with:

Director error: <class 'AttributeError'>: 'EncodedFile' object has no attribute 'write'

I don't know what EncodedFile is - there's no such struct/class in MuPDF or PyMuPDF.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions