Kozea / cairocffi

CFFI-based cairo bindings for Python.

Home Page:https://doc.courtbouillon.org/cairocffi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Minor fix for m1 Macs with CFFI issues

derekmerck opened this issue · comments

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--