After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 473576 - defsgen.py crashes when parsing an Interface first
defsgen.py crashes when parsing an Interface first
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: codegen
unspecified
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2007-09-04 14:04 UTC by Mark Doffman
Modified: 2008-07-16 10:13 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
Adding g_object_new to fix interface parsing. (530 bytes, patch)
2007-09-04 14:07 UTC, Mark Doffman
none Details | Review

Description Mark Doffman 2007-09-04 14:04:11 UTC
Please describe the problem:
When defsgen.py is used to parse interfaces it crashes when an interface type is parsed before any GObjects.

This is because the class structure for GObject has not been initialized. The GObject class initialization is where the param pool is set up. This could be considered a bug in GObject, but there is a very easy fix in defsgen. One, very small, fix is attached. It just consists of making a call to g_object_new to force the class structure initialization. 

Steps to reproduce:
Run the defsgen.py defs generator on any header file that just contains interface types. 



Actual results:
defsgen.py - An uncaught exception is thrown. 

(process:20299): GLib-GObject-CRITICAL **: g_param_spec_pool_list: assertion `pool != NULL' failed
Traceback (most recent call last):
  • File "defsgen.py", line 657 in <module>
    sys.exit(main(sys.argv))
  • File "defsgen.py", line 624 in main
    find_defs(buf, gobj, modlib, defs)
  • File "defsgen.py", line 222 in find_defs
    obj.set_properties(gobj)
  • File "defsgen.py", line 178 in set_properties
    self.props = self._get_ginterface_properties(gobj)
  • File "defsgen.py", line 192 in _get_ginterface_properties
    props = [plist[i][0].name for i in range(num.value)]
OverflowError: range() result has too many items

Expected results:


Does this happen every time?
Yes

Other information:
Comment 1 Mark Doffman 2007-09-04 14:07:21 UTC
Created attachment 94934 [details] [review]
Adding g_object_new to fix interface parsing.
Comment 2 John Finlay 2007-09-04 19:11:37 UTC
Thanks for the bug report and patch. Fixed in trunk:

	* codegen/defsgen.py (main): Create a GObject to initialize param pool
	Fixes #473576 (patch by Mark Doffman).

Committed revision 2902.
Comment 3 Johan (not receiving bugmail) Dahlin 2007-09-04 20:04:54 UTC
Mark: This definitely sounds like a bug in GObject, can you open up one there to make sure that the param pool is initialized lazily in interfaces just as it is for objects? (properties on interfaces is a fairly new feature)
Comment 4 Mark Doffman 2007-09-04 21:26:39 UTC
(In reply to comment #3)
> Mark: This definitely sounds like a bug in GObject, can you open up one there
> to make sure that the param pool is initialized lazily in interfaces just as it
> is for objects? (properties on interfaces is a fairly new feature)
> 

Johan: I have opened under GObject. Bug 473705