From ddba3def548b29809b2ca57f61eb6925857e5ed8 Mon Sep 17 00:00:00 2001 From: Roman Vlasenko Date: Sat, 21 Oct 2023 03:05:36 +0300 Subject: [PATCH] Stop singleton provider from recreating objects implementing __len__ --- rodi/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rodi/__init__.py b/rodi/__init__.py index 567eae8..21f4f0e 100644 --- a/rodi/__init__.py +++ b/rodi/__init__.py @@ -396,7 +396,7 @@ def __init__(self, _type, _args_callbacks): self._instance = None def __call__(self, context, parent_type): - if not self._instance: + if self._instance is None: self._instance = ( self._type(*[fn(context, self._type) for fn in self._args_callbacks]) if self._args_callbacks