mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-01-31 03:36:41 +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
|
||||
"""
|
||||
if self.instance:
|
||||
return self.instance
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user