r20479 - gnucash/trunk/src/optional/python-bindings - Bug #644762: Deprecated __new__() call in function_class.py
Christian Stimming
cstim at code.gnucash.org
Fri Mar 25 15:57:07 EDT 2011
Author: cstim
Date: 2011-03-25 15:57:07 -0400 (Fri, 25 Mar 2011)
New Revision: 20479
Trac: http://svn.gnucash.org/trac/changeset/20479
Modified:
gnucash/trunk/src/optional/python-bindings/function_class.py
Log:
Bug #644762: Deprecated __new__() call in function_class.py
Patch by Sara Arenson:
Patch to fix the deprecated __new__() call in function_class.py
When you create an object of type ClassFromFunctions (a subclass of object),
you get the following warning:
/opt/gnucash-2.4.0/lib/python2.6/site-packages/gnucash/function_class.py:55:
DeprecationWarning: object.__new__() takes no parameters
return super(ClassFromFunctions, cls).__new__(cls, *args, **kargs)
As per Python docs (http://docs.python.org/reference/datamodel.html), __new__()
accepts class name and a list of arguments for the object's constructor. Since
ClassFromFunctions's superclass's constructor has no arguments, we should not
be passing *args and **kargs.
Modified: gnucash/trunk/src/optional/python-bindings/function_class.py
===================================================================
--- gnucash/trunk/src/optional/python-bindings/function_class.py 2011-03-25 19:56:51 UTC (rev 20478)
+++ gnucash/trunk/src/optional/python-bindings/function_class.py 2011-03-25 19:57:07 UTC (rev 20479)
@@ -52,7 +52,7 @@
# use new to avoid creating new instances when existing instances
# already exist with the same __instance value, or equivlent __instance
# values, where this is desirable...
- return super(ClassFromFunctions, cls).__new__(cls, *args, **kargs)
+ return super(ClassFromFunctions, cls).__new__(cls)
def __init__(self, *args, **kargs):
"""Construct a new instance, using either the function
More information about the gnucash-changes
mailing list