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 312999 - nasty printout when making objects in ipython
nasty printout when making objects in ipython
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gobject
2.9.0
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2005-08-09 12:15 UTC by Andy Wingo
Modified: 2006-01-09 14:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
check module type first (1.71 KB, patch)
2005-08-09 12:20 UTC, Andy Wingo
none Details | Review
new patch, uses generic setattr protocol (1.57 KB, patch)
2005-08-09 12:46 UTC, Andy Wingo
none Details | Review

Description Andy Wingo 2005-08-09 12:15:49 UTC
import gst
gst.element_factory_make('ffmpegcolorspace')

returns the correct thing, but while doing so, tries to define the
GstFFMpegColorspace name in the __main__ module from sys.modules. Which is a
broken behavior, but hey, it's enshrined in history so that can't be changed.
The problem is that for ipython,

In [6]:sys.modules['__main__']
Out[6]:<IPython.FakeModule instance>

So that when it tries to define the class in __main__, it prints:

<ERROR: ../Objects/moduleobject.c:48: bad argument to internal function>

Because sys.modules['__main__'] isn't really a module.

Attached patch will work around this issue.
Comment 1 Andy Wingo 2005-08-09 12:20:29 UTC
Created attachment 50458 [details] [review]
check module type first
Comment 2 Andy Wingo 2005-08-09 12:40:18 UTC
jdahlin suggested using PyObject_SetItem. I tried it and it doesn't work for the
normal case or for the ipython case. Suggest that this patch be applied. This
behavior of pygtk is *extremely* crack anyway.
Comment 3 Andy Wingo 2005-08-09 12:46:42 UTC
Created attachment 50461 [details] [review]
new patch, uses generic setattr protocol
Comment 4 Andy Wingo 2005-08-09 12:56:18 UTC
Committed attachment #50461 [details], with some error checking, to HEAD.