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 639936 - [gi] Gdk.Window: Map the standard constructor to the *new* constructor
[gi] Gdk.Window: Map the standard constructor to the *new* constructor
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2011-01-19 11:59 UTC by Simon Schampijer
Modified: 2011-02-02 14:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[gi] Gdk.Window: Map the standard constructor to the *new* constructor (2.40 KB, patch)
2011-01-19 11:59 UTC, Simon Schampijer
none Details | Review
[gi] Gdk.Window: Map the standard constructor to the *new* constructor (1.96 KB, patch)
2011-01-19 15:21 UTC, Simon Schampijer
none Details | Review
Gdk.Window: Map the standard constructor to the *new* constructor (1.96 KB, patch)
2011-01-28 12:32 UTC, Tomeu Vizoso
none Details | Review

Description Simon Schampijer 2011-01-19 11:59:09 UTC
Gdk.Window had to be made abstract
(see c4a36d875235e0bf1e52dbf2fa14d08bfc8bd4ec in gtk),
this override allows using the standard constructor

This commit adds as well a testcase.
Comment 1 Simon Schampijer 2011-01-19 11:59:11 UTC
Created attachment 178708 [details] [review]
[gi] Gdk.Window: Map the standard constructor to the *new* constructor
Comment 2 Simon Schampijer 2011-01-19 15:21:23 UTC
Created attachment 178733 [details] [review]
[gi] Gdk.Window: Map the standard constructor to the *new* constructor

Gdk.Window had to be made abstract
(see c4a36d875235e0bf1e52dbf2fa14d08bfc8bd4ec in gtk),
this override allows using the standard constructor

This commit adds as well a testcase.
Comment 3 johnp 2011-01-26 20:52:33 UTC
I get this when I apply and run make check:

======================================================================
ERROR: test_constructor (test_overrides.TestGdk)
----------------------------------------------------------------------
Traceback (most recent call last):
  • File "/home/johnp/devel/gnome/source/pygobject-review/tests/test_overrides.py", line 337 in test_constructor
    window = Gdk.Window(None, attribute, attributes_mask)
  • File "/home/johnp/devel/gnome/source/pygobject-review/gi/overrides/Gdk.py", line 77 in __new__
    return Gdk.Window.new(parent, attribute, attributes_mask)
  • File "/home/johnp/devel/gnome/source/pygobject-review/gi/types.py", line 44 in function
    return info.invoke(*args)
TypeError: instance: Must be Gdk.Window, not NoneType

----------------------------------------------------------------------
Ran 396 tests in 7.650s
Comment 4 johnp 2011-01-26 20:54:53 UTC
I'm guessing gdk_window_new needs a (allow-none) annotation.
Comment 5 Tomeu Vizoso 2011-01-27 09:14:53 UTC
(In reply to comment #4)
> I'm guessing gdk_window_new needs a (allow-none) annotation.

We rather need https://bugzilla.gnome.org/show_bug.cgi?id=561264

Everybody is welcome to take that patch and run with it as I'm not sure when I will have time to deal with it.
Comment 6 Tomeu Vizoso 2011-01-28 12:32:06 UTC
Created attachment 179508 [details] [review]
Gdk.Window: Map the standard constructor to the *new* constructor

Gdk.Window had to be made abstract
(see c4a36d875235e0bf1e52dbf2fa14d08bfc8bd4ec in gtk),
this override allows using the standard constructor

This commit adds as well a testcase.

Renamed the construct-time property: s/attribute/attributes
Comment 7 Tomeu Vizoso 2011-02-01 16:18:50 UTC
Pushed, thanks!
Comment 8 Martin Pitt 2011-02-02 13:41:55 UTC
Hm, even with current g-i and pygobject I still get the test case failure from comment 3. What am I missing here?
Comment 9 Martin Pitt 2011-02-02 14:06:11 UTC
Indeed in current gtk master head, gdk_window_new() is still a method (due to the first argument which looks like a "this" pointer). If I fix that with

--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -1240,7 +1240,7 @@ sync_native_window_stack_position (GdkWindow *window)
 }

 /**
- * gdk_window_new:
+ * gdk_window_new: (constructor):

then it's back to being a ctor, and this test case works. As your referenced commit c4a36d875235e0bf1e52dbf2fa14d08bfc8bd4ec doesn't actually exist in gtk, above change might be what you wanted to refer to?
Comment 10 Martin Pitt 2011-02-02 14:15:07 UTC
As I also wanted to fix the Radio button constructors, I pushed this to GTK now:

  http://git.gnome.org/browse/gtk+/commit/?id=0e795b67c33400dcff78500a3fa0861af3ff0111

Now the tests work fine again, and we can also drop the special case workaround for radio button construction in Pygi apps.