Package: python-pyglet
Version: 1.1.4.dfsg-3
Severity: important
Tags: upstream patch

Dear Maintainer,

pyglet in stretch causes a segmentation fault when using the font
routines.  This can be trivially reproduced:

import pyglet
pyglet.font.load("", 30)

Segmentation fault

This problem does not occur in jessie.

I have tracked this down to the way that ctypes is being used to
call the fontconfig library.  Please find attached a patch which
fixes this.

This is probably important enough to consider a stable update once the
fix is in unstable, as any application which calls pyglet.font.load in
stretch will segmentation fault (e.g. psychopy as soon as a TextStim
object is created).


--- a/pyglet/font/
+++ b/pyglet/font/
@@ -52,6 +52,7 @@
 FcResult = c_int
+fontconfig.FcPatternCreate.restype = c_void_p
 fontconfig.FcPatternBuild.restype = c_void_p
 fontconfig.FcFontMatch.restype = c_void_p
 fontconfig.FcFreeTypeCharIndex.restype = c_uint
@@ -320,6 +321,7 @@
             name = name.encode('utf8')
         pattern = fontconfig.FcPatternCreate()
+        pattern = c_void_p(pattern)
         fontconfig.FcPatternAddDouble(pattern, FC_SIZE, c_double(size))
         fontconfig.FcPatternAddInteger(pattern, FC_WEIGHT, bold)
         fontconfig.FcPatternAddInteger(pattern, FC_SLANT, italic)
@@ -330,6 +332,7 @@
         # Look for a font that matches pattern
         result = FcResult()
         match = fontconfig.FcFontMatch(0, pattern, byref(result))
+        match = c_void_p(match)
         return match
Python-modules-team mailing list

Reply via email to