Kozea / cairocffi

CFFI-based cairo bindings for Python.
https://doc.courtbouillon.org/cairocffi
BSD 3-Clause "New" or "Revised" License
208 stars 54 forks source link

Minor fix for m1 Macs with CFFI issues #200

Closed derekmerck closed 1 year ago

derekmerck commented 2 years ago

Using Cairo on an m1, python 3.10, cairosvg from conda-forge

Command-line version translating from file to file works fine. However, direct library calls fail on any non-file output with a memory-write error from CFFI.

I don't know much about CFFI, but a small fix to surfaces.py to also catch MemoryErrors allows Cairo to fallback gracefully to a named temporary file as an intermediate form and work as expected.

surfaces.py:662 -> except (SystemError, MemoryError): # noqa

Thanks devs for your work maintaining this useful piece of open source software!

D--