From ecf771ce2f0ad3c8ff9e9059a40f2e9aed1cac6f Mon Sep 17 00:00:00 2001 From: Marco Sulla Date: Thu, 18 Nov 2021 23:28:03 +0100 Subject: [PATCH] added type hinting support for C extension --- frozendict/src/3_10/frozendictobject.c | 3 ++- frozendict/src/3_9/frozendictobject.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frozendict/src/3_10/frozendictobject.c b/frozendict/src/3_10/frozendictobject.c index 4c4905c..4136dcf 100644 --- a/frozendict/src/3_10/frozendictobject.c +++ b/frozendict/src/3_10/frozendictobject.c @@ -2132,7 +2132,8 @@ static PyMethodDef frozen_mapp_methods[] = { {"copy", (PyCFunction)frozendict_copy, METH_NOARGS, copy__doc__}, DICT___REVERSED___METHODDEF - {"__reduce__", (PyCFunction)(void(*)(void))frozendict_reduce, METH_NOARGS, + {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, "See PEP 585"}, + {"__reduce__", (PyCFunction)(void(*)(void))frozendict_reduce, METH_NOARGS, ""}, {NULL, NULL} /* sentinel */ }; diff --git a/frozendict/src/3_9/frozendictobject.c b/frozendict/src/3_9/frozendictobject.c index 00499e5..c0a4385 100644 --- a/frozendict/src/3_9/frozendictobject.c +++ b/frozendict/src/3_9/frozendictobject.c @@ -2128,7 +2128,8 @@ static PyMethodDef frozen_mapp_methods[] = { {"copy", (PyCFunction)frozendict_copy, METH_NOARGS, copy__doc__}, DICT___REVERSED___METHODDEF - {"__reduce__", (PyCFunction)(void(*)(void))frozendict_reduce, METH_NOARGS, + {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, "See PEP 585"}, + {"__reduce__", (PyCFunction)(void(*)(void))frozendict_reduce, METH_NOARGS, ""}, {NULL, NULL} /* sentinel */ }; @@ -2496,7 +2497,7 @@ PyTypeObject PyCoold_Type = { 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_as_async */ - (reprfunc)frozendict_repr, /* tp_repr */ + (reprfunc)frozendict_repr, /* tp_repr */ 0, /* tp_as_number */ &dict_as_sequence, /* tp_as_sequence */ &frozendict_as_mapping, /* tp_as_mapping */