You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Factory for TypeVar type can't be used for a specific type #527
If we try to use a factory for TypeVar type T without a wrapper Something[T] we will get dishka.exceptions.NoFactoryError. Slightly modified example from the documentation shows the problem:
Traceback (most recent call last):
File "xxx/test.py", line 16, in <module>
container.get(int)
File "xxx/python3.12/site-packages/dishka/container.py", line 164, in get
return self._get_unlocked(key)
^^^^^^^^^^^^^^^^^^^^^^^
File "xxx/python3.12/site-packages/dishka/container.py", line 195, in _get_unlocked
return self.parent_container._get(key) # noqa: SLF001
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "xxx/python3.12/site-packages/dishka/container.py", line 174, in _get
return self._get_unlocked(key)
^^^^^^^^^^^^^^^^^^^^^^^
File "xxx/python3.12/site-packages/dishka/container.py", line 189, in _get_unlocked
raise NoFactoryError(
dishka.exceptions.NoFactoryError: Cannot find factory for (int, component='', scope=Scope.APP). Check scopes in your providers. It is missing or has invalid scope.
Process finished with exit code 1
Looks like solving this can highly affect performance when accessing parent scopes. We need a faster way to distinguish objects with incorrect scope and absent ones
Activity
Tishka17 commentedon Aug 23, 2025
Looks like solving this can highly affect performance when accessing parent scopes. We need a faster way to distinguish objects with incorrect scope and absent ones
Tishka17 commentedon Sep 13, 2025
Probably related to implementation of #543