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 318874 - gdk_bitmap_create_from_data Exception with Python2.4.2
gdk_bitmap_create_from_data Exception with Python2.4.2
Status: RESOLVED FIXED
Product: pygtk
Classification: Bindings
Component: gtk
2.8.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2005-10-14 15:53 UTC by Bob Gibbs
Modified: 2007-05-15 09:42 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Bob Gibbs 2005-10-14 15:53:40 UTC
gibbs@t41:~$ python
Python 2.4.2 (#2, Sep 30 2005, 21:19:01)
[GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import array, gtk
>>> gtk.gdk.bitmap_create_from_data(None, array.array('B',
...     [0x00, 0x1f, 0x11, 0x1f, 0x00]).tostring(), 5, 5)
Traceback (most recent call last):
  • File "<stdin>", line 2 in ?
TypeError: bitmap_create_from_data() argument 2 must be string without null
bytes, not str
Comment 1 Bob Gibbs 2005-10-14 16:14:15 UTC
I was able to make it work by making the following changes to the generated
gdk.c file:

10609d10608
<     int length;
10611c10610
<     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"Os#ii:bitmap_create_from_data", kwlist, &py_drawable, &data, &length, &width,
&height))
---
>     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"Osii:bitmap_create_from_data", kwlist, &py_drawable, &data, &width, &height))

According to the Python extension API, it is necessary to use the "s#" format
when passing binary data that may contain NULL bytes.

see http://python.org/doc/2.4.2/api/arg-parsing.html

I am not sure how this change would translate into the .defs or .override files.
Comment 2 Johan (not receiving bugmail) Dahlin 2005-10-14 17:03:25 UTC
Checking in ChangeLog;
/cvs/gnome/gnome-python/pygtk/ChangeLog,v  <--  ChangeLog
new revision: 1.1324; previous revision: 1.1323
done
Checking in gtk/gdk.defs;
/cvs/gnome/gnome-python/pygtk/gtk/gdk.defs,v  <--  gdk.defs
new revision: 1.91; previous revision: 1.90
done
Checking in tests/Makefile.am;
/cvs/gnome/gnome-python/pygtk/tests/Makefile.am,v  <--  Makefile.am
new revision: 1.23; previous revision: 1.22
done
RCS file: /cvs/gnome/gnome-python/pygtk/tests/test_gdk.py,v
done
Checking in tests/test_gdk.py;
/cvs/gnome/gnome-python/pygtk/tests/test_gdk.py,v  <--  test_gdk.py
initial revision: 1.1
done
Comment 3 Pádraig Brady 2007-05-15 09:42:14 UTC
Note this bug was present for pygtk-2.8.[12]
Unfortunately ubuntu breezy was released with pygtk-2.8.1
Also this bug was fixed previously, the original bug being 103616