Armin Rigo <[email protected]> added the comment:

Ok, found it.  You are calling FT_New_Memory_Face() with the font_bytes being a
pointer just returned from PyArg_ParseTuple(..."s#"...), but you're not keeping
alive the object that held that memory.  CPython is "more or less safe" because
you call core.getfont(.., self.font_bytes) and thus keep the font_bytes string
alive as needed --- assuming, reasonably, that nobody does "font.font_bytes =
None" behind your back.  This doesn't work in PyPy because the data in the
font_bytes object is copied from GC memory to non-movable memory before the call
to core.getfont(), and freed afterwards.

I'd suggest that you change this to make the C-level FontObject keep a reference
to the font_bytes, rather than the Python-level FreeTypeFont.

________________________________________
PyPy bug tracker <[email protected]>
<https://bugs.pypy.org/issue1679>
________________________________________
_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to