]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Generic itertools.chain (GH-19417)
authorEthan Smith <ethan@ethanhs.me>
Fri, 10 Apr 2020 03:28:08 +0000 (20:28 -0700)
committerGitHub <noreply@github.com>
Fri, 10 Apr 2020 03:28:08 +0000 (20:28 -0700)
Lib/test/test_genericalias.py
Modules/itertoolsmodule.c

index 9c5b23e5e5b0fc600c048bdf4fc2bb5fbdddfabf..d8acdee2da3e26497a58d1121de30d94160fab15 100644 (file)
@@ -7,6 +7,7 @@ from collections import (
 )
 from collections.abc import *
 from contextlib import AbstractContextManager, AbstractAsyncContextManager
+from itertools import chain
 from os import DirEntry
 from re import Pattern, Match
 from types import GenericAlias, MappingProxyType
@@ -35,7 +36,8 @@ class BaseTest(unittest.TestCase):
                   Mapping, MutableMapping, MappingView,
                   KeysView, ItemsView, ValuesView,
                   Sequence, MutableSequence,
-                  MappingProxyType, DirEntry
+                  MappingProxyType, DirEntry,
+                  chain,
                   ):
             tname = t.__name__
             with self.subTest(f"Testing {tname}"):
index e99c964ac1d7903954049061dbcae3f67d4d95f6..4ebeb741b6b5c88049a61ae4dc6d190b7627df49 100644 (file)
@@ -2028,6 +2028,8 @@ static PyMethodDef chain_methods[] = {
      reduce_doc},
     {"__setstate__",    (PyCFunction)chain_setstate,    METH_O,
      setstate_doc},
+    {"__class_getitem__",    (PyCFunction)Py_GenericAlias,
+    METH_O|METH_CLASS,       PyDoc_STR("See PEP 585")},
     {NULL,              NULL}           /* sentinel */
 };