Skip to content

Commit a8403d0

Browse files
authored
Generic itertools.chain (GH-19417)
1 parent 38ada3b commit a8403d0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Lib/test/test_genericalias.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
)
88
from collections.abc import *
99
from contextlib import AbstractContextManager, AbstractAsyncContextManager
10+
from itertools import chain
1011
from os import DirEntry
1112
from re import Pattern, Match
1213
from types import GenericAlias, MappingProxyType
@@ -35,7 +36,8 @@ def test_subscriptable(self):
3536
Mapping, MutableMapping, MappingView,
3637
KeysView, ItemsView, ValuesView,
3738
Sequence, MutableSequence,
38-
MappingProxyType, DirEntry
39+
MappingProxyType, DirEntry,
40+
chain,
3941
):
4042
tname = t.__name__
4143
with self.subTest(f"Testing {tname}"):

Modules/itertoolsmodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,6 +2028,8 @@ static PyMethodDef chain_methods[] = {
20282028
reduce_doc},
20292029
{"__setstate__", (PyCFunction)chain_setstate, METH_O,
20302030
setstate_doc},
2031+
{"__class_getitem__", (PyCFunction)Py_GenericAlias,
2032+
METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
20312033
{NULL, NULL} /* sentinel */
20322034
};
20332035

0 commit comments

Comments
 (0)