Skip to content

Commit

Permalink
Make types.MappingProxyType generic (python#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmatyping authored Feb 25, 2020
1 parent c534f67 commit 2f94a36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Lib/test/test_genericalias.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from collections.abc import *
from contextlib import AbstractContextManager, AbstractAsyncContextManager
from re import Pattern, Match
from types import GenericAlias
from types import GenericAlias, MappingProxyType

from typing import TypeVar
T = TypeVar('T')
Expand All @@ -33,6 +33,7 @@ def test_subscriptable(self):
Mapping, MutableMapping, MappingView,
KeysView, ItemsView, ValuesView,
Sequence, MutableSequence,
MappingProxyType,
):
tname = t.__name__
with self.subTest(f"Testing {tname}"):
Expand Down
2 changes: 2 additions & 0 deletions Objects/descrobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,8 @@ static PyMethodDef mappingproxy_methods[] = {
PyDoc_STR("D.items() -> list of D's (key, value) pairs, as 2-tuples")},
{"copy", (PyCFunction)mappingproxy_copy, METH_NOARGS,
PyDoc_STR("D.copy() -> a shallow copy of D")},
{"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_O|METH_CLASS,
PyDoc_STR("See PEP 585")},
{0}
};

Expand Down

0 comments on commit 2f94a36

Please sign in to comment.