Created attachment 24788 [details] [review] Patch to fix DeprecationWarning for object __init__ In Python 2.6 object's __init__ no longer ignores extra parameters and emits the following warning, whenever the Connection class is instantiated in Python. DeprecationWarning: object.__init__() takes no parameters The attached patch fixes this.
*** Bug 22955 has been marked as a duplicate of this bug. ***
I don't think that's the right patch for this, but I've prepared another: http://git.collabora.co.uk/?p=user/smcv/dbus-python-smcv.git;a=shortlog;h=refs/heads/2.6
(In reply to comment #2) > I don't think that's the right patch for this, but I've prepared another: > > http://git.collabora.co.uk/?p=user/smcv/dbus-python-smcv.git;a=shortlog;h=refs/heads/2.6 > I'm probably not the best person to be reviewing this, but... The "Passing arbitrary args into an __init__ and getting them silently ignored" thing deprecated in 2.6 for a reason. If we at least warn about args/kwargs we don't understand then ++. I don't know the codebase enough to be able to quickly assert whether we do or not. If someone more knowledgeable than me can assert this then ship it. If we don't warn about unknown args, then on a scale of "completely fine" to "as messed up as overriding __getattr__" I would give this a 5.
I am thinking maybe the server.c or Server.py has the same problem.
Following discussion on IRC: (In reply to comment #3) > If we at least warn about args/kwargs we > don't understand then ++. These are an error in __new__; as such, __init__ doesn't need to check them again.
(In reply to comment #4) > I am thinking maybe the server.c or Server.py has the same problem. Good thinking, but actually no: Server.__init__ doesn't chain up to _Server's tp_init (and hence object.__init__). However, Server use will provoke the same warning whenever a Server instantiates a Connection (is that what you meant?)
(In reply to comment #6) > (In reply to comment #4) > > I am thinking maybe the server.c or Server.py has the same problem. > > Good thinking, but actually no: Server.__init__ doesn't chain up to _Server's > tp_init (and hence object.__init__). > > However, Server use will provoke the same warning whenever a Server > instantiates a Connection (is that what you meant?) > In commnet #2, you don't think removing __init__ in connection.py is a right solution, but the Server.py does not call __init__ too, and it avoids the same problem. I mean maybe it is better to avoid the same problem by same solution.
Fixed in 0.83.1
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.