fix: uniform prior instantiation

This commit is contained in:
mzwiessele 2017-10-02 16:04:44 +01:00
parent 5a0dc22426
commit 8826ebeb8d

View file

@ -100,7 +100,11 @@ class Uniform(Prior):
for instance in cls._instances: for instance in cls._instances:
if instance().lower == lower and instance().upper == upper: if instance().lower == lower and instance().upper == upper:
return instance() return instance()
o = super(Prior, cls).__new__(cls, lower, upper) newfunc = super(Prior, cls).__new__
if newfunc is object.__new__:
o = newfunc(cls)
else:
o = newfunc(cls, lower, upper)
cls._instances.append(weakref.ref(o)) cls._instances.append(weakref.ref(o))
return cls._instances[-1]() return cls._instances[-1]()