GNOME Bugzilla – Bug 311139
pango.Context() creates invalid abstract object
Last modified: 2008-05-15 19:44:18 UTC
Please describe the problem: Running the following sample script leads to a segmentation fault: #! /usr/bin/env python import pango import gtk.gdk print "1" p = gtk.gdk.Pixmap(None,768,512,24) print "2" gc = p.new_gc() print "3" pl = pango.Layout(pango.Context()) print "4" pl.set_text("H E L L O") print "5" p.draw_layout(gc,10,10,pl) print "6" Steps to reproduce: 1. Run above script Actual results: torsten@pulsar:~$ python test.py 1 2 3 4 5 (test.py:9824): Pango-CRITICAL **: pango_font_map_load_fontset: assertion `fontmap != NULL' failed (test.py:9824): GLib-GObject-CRITICAL **: g_object_get_qdata: assertion `G_IS_OBJECT (object)' failed (test.py:9824): GLib-GObject-CRITICAL **: g_object_set_qdata_full: assertion `G_IS_OBJECT (object)' failed (test.py:9824): Pango-CRITICAL **: pango_font_map_get_shape_engine_type: assertion `PANGO_IS_FONT_MAP (fontmap)' failed (test.py:9824): GLib-CRITICAL **: g_quark_from_string: assertion `string != NULL' failed Segmentation fault Expected results: pango.Context() should throw an exception because pango.Context is abstract. Does this happen every time? Yes Other information: see http://bugs.debian.org/317105
A pango.Context is not an abstract object and is created by Python when using the constructor but is probably not properly initialized. Several pango types have this problem as well: Font, FontFace, FontFamily, FontMap, FontMetrics
*** Bug 317342 has been marked as a duplicate of this bug. ***
This bug as been fixed already >>> c = pango.Context() Traceback (most recent call last):
+ Trace 197815
>>> c = pango.Font() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: cannot create instance of abstract (non-instantiable) type `PangoFont' >>> c = pango.FontMap() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: cannot create instance of abstract (non-instantiable) type `PangoFontMap' >>> c = pango.FontFamily() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: cannot create instance of abstract (non-instantiable) type `PangoFontFamily' >>>