mirror of https://github.com/python/cpython
bpo-39481: PEP 585 for enumerate, AsyncGeneratorType, mmap (GH-19421)
This commit is contained in:
parent
2fa67df605
commit
7c4185d62d
|
@ -7,11 +7,12 @@ from collections import (
|
||||||
)
|
)
|
||||||
from collections.abc import *
|
from collections.abc import *
|
||||||
from contextlib import AbstractContextManager, AbstractAsyncContextManager
|
from contextlib import AbstractContextManager, AbstractAsyncContextManager
|
||||||
|
from mmap import mmap
|
||||||
from ipaddress import IPv4Network, IPv4Interface, IPv6Network, IPv6Interface
|
from ipaddress import IPv4Network, IPv4Interface, IPv6Network, IPv6Interface
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from os import DirEntry
|
from os import DirEntry
|
||||||
from re import Pattern, Match
|
from re import Pattern, Match
|
||||||
from types import GenericAlias, MappingProxyType
|
from types import GenericAlias, MappingProxyType, AsyncGeneratorType
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from typing import TypeVar
|
from typing import TypeVar
|
||||||
|
@ -21,7 +22,8 @@ class BaseTest(unittest.TestCase):
|
||||||
"""Test basics."""
|
"""Test basics."""
|
||||||
|
|
||||||
def test_subscriptable(self):
|
def test_subscriptable(self):
|
||||||
for t in (type, tuple, list, dict, set, frozenset,
|
for t in (type, tuple, list, dict, set, frozenset, enumerate,
|
||||||
|
mmap,
|
||||||
defaultdict, deque,
|
defaultdict, deque,
|
||||||
OrderedDict, Counter, UserDict, UserList,
|
OrderedDict, Counter, UserDict, UserList,
|
||||||
Pattern, Match,
|
Pattern, Match,
|
||||||
|
@ -37,10 +39,9 @@ class BaseTest(unittest.TestCase):
|
||||||
Mapping, MutableMapping, MappingView,
|
Mapping, MutableMapping, MappingView,
|
||||||
KeysView, ItemsView, ValuesView,
|
KeysView, ItemsView, ValuesView,
|
||||||
Sequence, MutableSequence,
|
Sequence, MutableSequence,
|
||||||
MappingProxyType,
|
MappingProxyType, AsyncGeneratorType,
|
||||||
DirEntry,
|
DirEntry,
|
||||||
IPv4Network, IPv4Interface, IPv6Network, IPv6Interface,
|
IPv4Network, IPv4Interface, IPv6Network, IPv6Interface,
|
||||||
MappingProxyType, DirEntry,
|
|
||||||
chain,
|
chain,
|
||||||
):
|
):
|
||||||
tname = t.__name__
|
tname = t.__name__
|
||||||
|
|
|
@ -816,6 +816,8 @@ static struct PyMethodDef mmap_object_methods[] = {
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
{"__sizeof__", (PyCFunction) mmap__sizeof__method, METH_NOARGS},
|
{"__sizeof__", (PyCFunction) mmap__sizeof__method, METH_NOARGS},
|
||||||
#endif
|
#endif
|
||||||
|
{"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_O|METH_CLASS,
|
||||||
|
PyDoc_STR("See PEP 585")},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -201,6 +201,8 @@ PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
|
||||||
|
|
||||||
static PyMethodDef enum_methods[] = {
|
static PyMethodDef enum_methods[] = {
|
||||||
{"__reduce__", (PyCFunction)enum_reduce, METH_NOARGS, reduce_doc},
|
{"__reduce__", (PyCFunction)enum_reduce, METH_NOARGS, reduce_doc},
|
||||||
|
{"__class_getitem__", (PyCFunction)Py_GenericAlias,
|
||||||
|
METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1346,6 +1346,8 @@ static PyMethodDef async_gen_methods[] = {
|
||||||
{"asend", (PyCFunction)async_gen_asend, METH_O, async_asend_doc},
|
{"asend", (PyCFunction)async_gen_asend, METH_O, async_asend_doc},
|
||||||
{"athrow",(PyCFunction)async_gen_athrow, METH_VARARGS, async_athrow_doc},
|
{"athrow",(PyCFunction)async_gen_athrow, METH_VARARGS, async_athrow_doc},
|
||||||
{"aclose", (PyCFunction)async_gen_aclose, METH_NOARGS, async_aclose_doc},
|
{"aclose", (PyCFunction)async_gen_aclose, METH_NOARGS, async_aclose_doc},
|
||||||
|
{"__class_getitem__", (PyCFunction)Py_GenericAlias,
|
||||||
|
METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
|
||||||
{NULL, NULL} /* Sentinel */
|
{NULL, NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue