Skip to content

Commit

Permalink
Fix singleton bugs related to thread-safety and checks for sequence t…
Browse files Browse the repository at this point in the history
…ypes
  • Loading branch information
rmk135 committed Jun 8, 2016
1 parent d963e9b commit 2fcfa79
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions dependency_injector/providers/creational.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,10 @@ def _provide(self, *args, **kwargs):
: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


Expand Down

0 comments on commit 2fcfa79

Please sign in to comment.