Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-145056: Let dict specific tests accept frozendict as well
  • Loading branch information
rhettinger committed Feb 21, 2026
commit f27f128ab9ddcecee092e4f9ff61b9f95b2d505d
8 changes: 4 additions & 4 deletions Lib/collections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,14 @@ def __ior__(self, other):
return self

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)
Expand Down Expand Up @@ -1221,14 +1221,14 @@ def __repr__(self):
def __or__(self, other):
if isinstance(other, UserDict):
return self.__class__(self.data | other.data)
if isinstance(other, dict):
if isinstance(other, (dict, frozendict)):
return self.__class__(self.data | other)
return NotImplemented

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

Expand Down
Loading