Skip to content

Commit 2f94a36

Browse files
authored
Make types.MappingProxyType generic (python#13)
1 parent c534f67 commit 2f94a36

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Lib/test/test_genericalias.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from collections.abc import *
99
from contextlib import AbstractContextManager, AbstractAsyncContextManager
1010
from re import Pattern, Match
11-
from types import GenericAlias
11+
from types import GenericAlias, MappingProxyType
1212

1313
from typing import TypeVar
1414
T = TypeVar('T')
@@ -33,6 +33,7 @@ def test_subscriptable(self):
3333
Mapping, MutableMapping, MappingView,
3434
KeysView, ItemsView, ValuesView,
3535
Sequence, MutableSequence,
36+
MappingProxyType,
3637
):
3738
tname = t.__name__
3839
with self.subTest(f"Testing {tname}"):

Objects/descrobject.c

+2
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,8 @@ static PyMethodDef mappingproxy_methods[] = {
10661066
PyDoc_STR("D.items() -> list of D's (key, value) pairs, as 2-tuples")},
10671067
{"copy", (PyCFunction)mappingproxy_copy, METH_NOARGS,
10681068
PyDoc_STR("D.copy() -> a shallow copy of D")},
1069+
{"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_O|METH_CLASS,
1070+
PyDoc_STR("See PEP 585")},
10691071
{0}
10701072
};
10711073

0 commit comments

Comments
 (0)