From eacb190907488c5c66fff611aca5f35298692e38 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Mon, 26 Apr 2021 22:07:48 -0400 Subject: [PATCH 1/2] Improve wiring fault tolerance --- src/dependency_injector/wiring.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/dependency_injector/wiring.py b/src/dependency_injector/wiring.py index 029cc069..6f54c993 100644 --- a/src/dependency_injector/wiring.py +++ b/src/dependency_injector/wiring.py @@ -342,11 +342,17 @@ def wire( # noqa: C901 _patch_fn(module, member_name, member, providers_map) elif inspect.isclass(member): cls = member - for cls_member_name, cls_member in inspect.getmembers(cls): - if _is_marker(cls_member): - _patch_attribute(cls, cls_member_name, cls_member, providers_map) - elif _is_method(cls_member): - _patch_method(cls, cls_member_name, cls_member, providers_map) + try: + cls_members = inspect.getmembers(cls) + except Exception: # noqa + # Hotfix, see: https://github.com/ets-labs/python-dependency-injector/issues/441 + continue + else: + for cls_member_name, cls_member in cls_members: + if _is_marker(cls_member): + _patch_attribute(cls, cls_member_name, cls_member, providers_map) + elif _is_method(cls_member): + _patch_method(cls, cls_member_name, cls_member, providers_map) for patched in _patched_registry.get_callables_from_module(module): _bind_injections(patched, providers_map) From 39fb88a0e927bc2e9f0559e33e3619c8d3a551e9 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Mon, 26 Apr 2021 22:09:35 -0400 Subject: [PATCH 2/2] Bump version to 4.32.2 --- docs/main/changelog.rst | 6 ++++++ src/dependency_injector/__init__.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index 442e043c..af592f21 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -7,6 +7,12 @@ that were made in every particular version. From version 0.7.6 *Dependency Injector* framework strictly follows `Semantic versioning`_ +4.32.2 +------ +- Improve wiring fault tolerance. + See issue `#441 `_. + Thanks to `@ssheng `_ for reporting the issue. + 4.32.1 ------ - Fix a bug with ``List`` provider not working in async mode. diff --git a/src/dependency_injector/__init__.py b/src/dependency_injector/__init__.py index 941708f7..35a30129 100644 --- a/src/dependency_injector/__init__.py +++ b/src/dependency_injector/__init__.py @@ -1,6 +1,6 @@ """Top-level package.""" -__version__ = '4.32.1' +__version__ = '4.32.2' """Version number. :type: str