We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After updating to 4.46.0, there is an endless iteration through the list when using Configuration.
For example:
from dependency_injector.containers import DeclarativeContainer from dependency_injector.providers import Configuration, Resource, Factory from dependency_injector.wiring import Provide, Closing def test_resource(string: str): print("init resource") yield f"resource {string}" print("shutdown resource") class Service: def __init__(self, resource: str): self.resource = resource def execute(self): print(self.resource) class DIContainer(DeclarativeContainer): config = Configuration() resource = Resource(test_resource, config.foo) service = Factory(Service, resource=resource) container = DIContainer() container.config.from_dict({"foo": "test"}) def foo( service: Service = Closing[Provide["service"]], ): print("foo") service.execute() if __name__ == "__main__": container.wire(modules=[__name__]) foo()
At the same time, nothing is output to the console and no error occurs.
I suggest making the following fixes, but I'm not sure they won't break anything.
def _locate_dependent_closing_args( provider: providers.Provider, closing_deps: Dict[str, providers.Provider] ) -> Dict[str, providers.Provider]: for arg in [ *getattr(provider, "args", []), *getattr(provider, "kwargs", {}).values(), ]: if not isinstance(arg, providers.Provider): continue if isinstance(arg, providers.ConfigurationOption): continue if isinstance(arg, providers.Resource): closing_deps[str(id(arg))] = arg _locate_dependent_closing_args(arg, closing_deps)
The text was updated successfully, but these errors were encountered:
Got the same issue using Closing in FastApi handler (v0.115.11) + SQLAlchemy app (di v 4.46.0)
Sorry, something went wrong.
Release?
No branches or pull requests
After updating to 4.46.0, there is an endless iteration through the list when using Configuration.
For example:
At the same time, nothing is output to the console and no error occurs.
I suggest making the following fixes, but I'm not sure they won't break anything.
The text was updated successfully, but these errors were encountered: