From a6e28205e11df95348d148b22af9550f5381eee2 Mon Sep 17 00:00:00 2001 From: Mike Croucher Date: Sat, 28 Feb 2015 18:36:52 +0000 Subject: [PATCH] Ensure that object.__new__ never gets called with arguments --- GPy/core/parameterization/priors.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GPy/core/parameterization/priors.py b/GPy/core/parameterization/priors.py index 432e2473..6c7f655f 100644 --- a/GPy/core/parameterization/priors.py +++ b/GPy/core/parameterization/priors.py @@ -148,7 +148,11 @@ class LogGaussian(Gaussian): for instance in cls._instances: if instance().mu == mu and instance().sigma == sigma: return instance() - o = super(Prior, cls).__new__(cls, mu, sigma) + newfunc = super(Prior, cls).__new__ + if newfunc is object.__new__: + o = newfunc(cls) + else: + o = newfunc(cls, mu, sigma) cls._instances.append(weakref.ref(o)) return cls._instances[-1]()