Fix singleton bugs related to thread-safety and checks for sequence types

This commit is contained in:
Roman Mogilatov 2016-06-08 17:02:39 +03:00
parent d963e9b562
commit 2fcfa79ffd

View File

@ -212,12 +212,10 @@ class Singleton(Factory):
:rtype: object :rtype: object
""" """
if self.instance:
return self.instance
with GLOBAL_LOCK: with GLOBAL_LOCK:
self.instance = super(Singleton, self)._provide(*args, **kwargs) if self.instance is None:
self.instance = super(Singleton, self)._provide(*args,
**kwargs)
return self.instance return self.instance