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 707904 - Can't change signature of __init__ in subclass of GLib.Source
Can't change signature of __init__ in subclass of GLib.Source
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: general
Git master
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2013-09-11 11:04 UTC by Peter Ward
Modified: 2013-09-11 12:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix GLib.Source sub-classing with initializer args (1.64 KB, patch)
2013-09-11 12:11 UTC, Simon Feltman
committed Details | Review

Description Peter Ward 2013-09-11 11:04:33 UTC
$ cat test.py
from gi.repository import GLib

class MySource(GLib.Source):
    def __init__(self, arg):
        super(MySource, self).__init__()

source = MySource(5)

$ python test.py
Traceback (most recent call last):
  • File "test.py", line 7 in <module>
    source = MySource(5)
TypeError: __new__() takes 1 positional argument but 2 were given

Comment 1 Simon Feltman 2013-09-11 12:11:25 UTC
The following fix has been pushed:
59a2964 Fix GLib.Source sub-classing with initializer args
Comment 2 Simon Feltman 2013-09-11 12:11:27 UTC
Created attachment 254670 [details] [review]
Fix GLib.Source sub-classing with initializer args

Add variable args and keyword args to the GLib.Source.__new__
method to support sub-classes which want to implement __init__.