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 647272 - Handle GValues with GType==0 as None, for libgda
Handle GValues with GType==0 as None, for libgda
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
2.28.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks: 647633
 
 
Reported: 2011-04-09 13:21 UTC by Murray Cumming
Modified: 2011-08-13 10:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-pyg_value_as_pyobject-Return-None-for-a-GValue-with-.patch (1.01 KB, patch)
2011-04-09 13:21 UTC, Murray Cumming
none Details | Review
test_value_none.c (307 bytes, text/plain)
2011-04-13 08:30 UTC, Murray Cumming
  Details

Description Murray Cumming 2011-04-09 13:21:41 UTC
Created attachment 185584 [details] [review]
0001-pyg_value_as_pyobject-Return-None-for-a-GValue-with-.patch

This patch fixes the gi.repository.Gda API, fixing the problem mentioned here:
http://mail.gnome.org/archives/gnome-db-list/2011-April/msg00002.html

This is necessary because libgda uses a GValue with a 0 GType to mean a Null database value. It has a gda_value_is_null() function that detects it, for instance.
Comment 1 Murray Cumming 2011-04-09 13:22:09 UTC
By the way, I have no real idea if this is appropriate, or if the patch is correct.
Comment 2 Simon van der Linden 2011-04-11 08:14:01 UTC
If I'm right, GType 0 is G_TYPE_INVALID. It should not map to None but raise an error. G_TYPE_NONE seems more appropriate in this case. Why isn't it used?
Comment 3 Murray Cumming 2011-04-13 08:30:44 UTC
Created attachment 185849 [details]
test_value_none.c

Test to show that GValue can't contain a G_TYPE_NONE.
Comment 4 Murray Cumming 2011-04-13 08:32:17 UTC
G_TYPE_NONE does seem more appropriate, but this test shows that it's not currently possible. I see these warnings on the command-line:

(process:30915): GLib-GObject-WARNING **: can't peek value table for type `void' which is not currently referenced

(process:30915): GLib-GObject-WARNING **: gvalue.c:191: cannot initialize GValue with type `void', this type has no GTypeValueTable implementation

Note that one of those is an error in the code that actually prints the warning in g_value_init().

Maybe libgda needs its own custom GDA_TYPE_NULL type that doesn't map to any existing type.
Comment 5 Tomeu Vizoso 2011-04-13 09:19:35 UTC
(In reply to comment #4)
> 
> Maybe libgda needs its own custom GDA_TYPE_NULL type that doesn't map to any
> existing type.

I think it would make sense to have GDA_TYPE_NULL to refer to a SQL NULL value.
Comment 6 Johan (not receiving bugmail) Dahlin 2011-04-13 12:05:00 UTC
Or simply fix GObject to allow you to put G_TYPE_NONE into a GValue.
Comment 7 Daniel Espinosa 2011-06-08 16:01:26 UTC
Please refer to Bug #647633. It have patches to solve this issue.
Comment 8 johnp 2011-06-08 17:45:35 UTC
Does this mean that everything will be fixed in libgda and there are no modifications needed for PyGObject? Can this bug be closed?
Comment 9 Murray Cumming 2011-06-08 18:15:32 UTC
It will probably be fixed in libgda, yes, but it's not fixed yet.
Comment 10 malerba 2011-06-14 17:05:05 UTC
This is now fixed in libgda/master: http://git.gnome.org/browse/libgda/commit/?id=3f7456ef94b1b0f539267d02f32d8563dc9bb541