mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-01-31 11:51:39 +03:00
Fix singleton bugs related to thread-safety and checks for sequence types
This commit is contained in:
parent
d963e9b562
commit
2fcfa79ffd
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user