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.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20479 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming
2011-03-25 19:57:07 +00:00
parent 39030f8a73
commit 0c0297bcb3

View File

@@ -52,7 +52,7 @@ class ClassFromFunctions(object):
# 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