gh-145056: Fix merging of OrderedDict and UserDict with frozendict by serhiy-storchaka · Pull Request #146295 · python/cpython
def __or__(self, other): if not isinstance(other, dict): if not isinstance(other, (dict, frozendict)): return NotImplemented new = self.__class__(self) new.update(other) return new
def __ror__(self, other): if not isinstance(other, dict): if not isinstance(other, (dict, frozendict)): return NotImplemented new = self.__class__(other) new.update(self)
def __ror__(self, other): if isinstance(other, UserDict): return self.__class__(other.data | self.data) if isinstance(other, dict): if isinstance(other, (dict, frozendict)): return self.__class__(other | self.data) return NotImplemented