diff --git a/HISTORY.rst b/HISTORY.rst index 6f59b9bc..98835255 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,8 @@ History * ``converter.unstructure`` now supports an optional parameter, `unstructure_as`, which can be used to unstructure something as a different type. Useful for unions. * Improve support for union un/structuring hooks. Flesh out docs for advanced union handling. (`#115 `_) +* Fix `GenConverter` behavior with inheritance hierarchies of `attrs` classes. + (`#117 `_) (`#116 `_) 1.1.2 (2020-11-29) ------------------ diff --git a/src/cattr/multistrategy_dispatch.py b/src/cattr/multistrategy_dispatch.py index 6927a59d..d211f3bd 100644 --- a/src/cattr/multistrategy_dispatch.py +++ b/src/cattr/multistrategy_dispatch.py @@ -32,7 +32,7 @@ class MultiStrategyDispatch(object): ) def __init__(self, fallback_func): - self._direct_dispatch = dict() + self._direct_dispatch = {} self._function_dispatch = FunctionDispatch() self._function_dispatch.register(lambda _: True, fallback_func) self._single_dispatch = singledispatch(_DispatchNotFound) @@ -41,7 +41,7 @@ def __init__(self, fallback_func): def _dispatch(self, cl): try: direct_dispatch = self._direct_dispatch.get(cl) - if direct_dispatch: + if direct_dispatch is not None: return direct_dispatch dispatch = self._single_dispatch.dispatch(cl) if dispatch is not _DispatchNotFound: