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 743468 - Add namespace and container name to callable cache and include them in all warnings/error messages
Add namespace and container name to callable cache and include them in all wa...
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2015-01-25 09:37 UTC by Christoph Reiter (lazka)
Modified: 2015-03-03 12:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch v1 (17.87 KB, patch)
2015-01-25 09:37 UTC, Christoph Reiter (lazka)
accepted-commit_now Details | Review
patch v2 (17.93 KB, patch)
2015-01-27 18:15 UTC, Christoph Reiter (lazka)
committed Details | Review

Description Christoph Reiter (lazka) 2015-01-25 09:37:58 UTC
Created attachment 295363 [details] [review]
patch v1

b = Gtk.Button()
b.set_label(1,2,3)

before: TypeError: set_label() takes exactly 2 arguments (4 given)
after:  TypeError: Gtk.Button.set_label() takes exactly 2 arguments (4 given)

##########

Gtk.Arrow.new(Gtk.ArrowType.RIGHT, Gtk.ShadowType.NONE)

before: DeprecationWarning: Gtk.new is deprecated
after:  DeprecationWarning: Gtk.Arrow.new is deprecated

##########

table = Gtk.Table()
table.set_homogeneous(True)

before: DeprecationWarning: Gtk.set_homogeneous is deprecated
after:  DeprecationWarning: Gtk.Table.set_homogeneous is deprecated
Comment 1 Christoph Reiter (lazka) 2015-01-25 10:24:09 UTC
(In reply to comment #0)
> b = Gtk.Button()
> b.set_label(1,2,3)
> 
> before: TypeError: set_label() takes exactly 2 arguments (4 given)
> after:  TypeError: Gtk.Button.set_label() takes exactly 2 arguments (4 given)

I'd like to add that Python itself only prints the function name in this case, so the new behavior is inconsistent. I personally like the additional info, but if consistency is preferred I'm happy to revert those cases.
Comment 2 Simon Feltman 2015-01-27 05:59:37 UTC
Review of attachment 295363 [details] [review]:

Looks good, just some minor style nitpicks.

::: gi/pygi-cache.c
@@ +668,3 @@
     cache->name = g_base_info_get_name ((GIBaseInfo *) callable_info);
+    cache->namespace = g_base_info_get_namespace ((GIBaseInfo *) callable_info);
+    container = g_base_info_get_container((GIBaseInfo *) callable_info);

Space needed after function name and before open parenthesis.

@@ +671,3 @@
+    cache->container_name = NULL;
+    /* https://bugzilla.gnome.org/show_bug.cgi?id=709456 */
+    if (container != NULL && g_base_info_get_type(container) != GI_INFO_TYPE_TYPE) {

here too

@@ +679,3 @@
         const gchar *deprecated = g_base_info_get_attribute (callable_info, "deprecated");
         gchar *warning;
+        gchar *full_name = pygi_callable_cache_get_full_name(cache);

same

@@ +711,3 @@
+{
+    if (cache->container_name != NULL) {
+        return g_strjoin(".",

same

@@ +717,3 @@
+                         NULL);
+    } else {
+        return g_strjoin(".",

same
Comment 3 Christoph Reiter (lazka) 2015-01-27 18:15:55 UTC
Created attachment 295564 [details] [review]
patch v2

Thanks!
Comment 4 Simon Feltman 2015-03-01 05:03:15 UTC
Review of attachment 295564 [details] [review]:

LGTM, Thanks!