gh-132882: Fix copying of unions with members that do not support __o… · python/cpython@e1c09ff · GitHub
Skip to content

Commit e1c09ff

Browse files
gh-132882: Fix copying of unions with members that do not support __or__ (#132883)
1 parent 9f5994b commit e1c09ff

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

Lib/copyreg.py

Lines changed: 2 additions & 2 deletions

Lib/test/test_typing.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5283,10 +5283,12 @@ class Node(Generic[T]): ...
52835283
Tuple[Any, Any], Node[T], Node[int], Node[Any], typing.Iterable[T],
52845284
typing.Iterable[Any], typing.Iterable[int], typing.Dict[int, str],
52855285
typing.Dict[T, Any], ClassVar[int], ClassVar[List[T]], Tuple['T', 'T'],
5286-
Union['T', int], List['T'], typing.Mapping['T', int]]
5287-
for t in things + [Any]:
5288-
self.assertEqual(t, copy(t))
5289-
self.assertEqual(t, deepcopy(t))
5286+
Union['T', int], List['T'], typing.Mapping['T', int],
5287+
Union[b"x", b"y"], Any]
5288+
for t in things:
5289+
with self.subTest(thing=t):
5290+
self.assertEqual(t, copy(t))
5291+
self.assertEqual(t, deepcopy(t))
52905292

52915293
def test_immutability_by_copy_and_pickle(self):
52925294
# Special forms like Union, Any, etc., generic aliases to containers like List,
Lines changed: 2 additions & 0 deletions

0 commit comments

Comments
 (0)