Skip to content

Commit 33ea83e

Browse files
Copilotm-aciek
andcommitted
Add __class_getitem__ support to all datetime types
Co-authored-by: m-aciek <9288014+m-aciek@users.noreply.github.com>
1 parent d9d3a0e commit 33ea83e

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎Modules/_datetimemodule.c‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3052,6 +3052,9 @@ static PyMethodDef delta_methods[] = {
30523052
{"__reduce__", delta_reduce, METH_NOARGS,
30533053
PyDoc_STR("__reduce__() -> (cls, state)")},
30543054

3055+
{"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS,
3056+
PyDoc_STR("See PEP 585")},
3057+
30553058
{NULL, NULL},
30563059
};
30573060

@@ -4015,6 +4018,9 @@ static PyMethodDef date_methods[] = {
40154018
{"__reduce__", date_reduce, METH_NOARGS,
40164019
PyDoc_STR("__reduce__() -> (cls, state)")},
40174020

4021+
{"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS,
4022+
PyDoc_STR("See PEP 585")},
4023+
40184024
{NULL, NULL}
40194025
};
40204026

@@ -4251,6 +4257,9 @@ static PyMethodDef tzinfo_methods[] = {
42514257
{"__reduce__", tzinfo_reduce, METH_NOARGS,
42524258
PyDoc_STR("-> (cls, state)")},
42534259

4260+
{"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS,
4261+
PyDoc_STR("See PEP 585")},
4262+
42544263
{NULL, NULL}
42554264
};
42564265

@@ -4499,6 +4508,9 @@ static PyMethodDef timezone_methods[] = {
44994508
{"__getinitargs__", timezone_getinitargs, METH_NOARGS,
45004509
PyDoc_STR("pickle support")},
45014510

4511+
{"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS,
4512+
PyDoc_STR("See PEP 585")},
4513+
45024514
{NULL, NULL}
45034515
};
45044516

@@ -5291,6 +5303,9 @@ static PyMethodDef time_methods[] = {
52915303
DATETIME_TIME___REDUCE_EX___METHODDEF
52925304
DATETIME_TIME___REDUCE___METHODDEF
52935305

5306+
{"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS,
5307+
PyDoc_STR("See PEP 585")},
5308+
52945309
{NULL, NULL}
52955310
};
52965311

@@ -7255,6 +7270,9 @@ static PyMethodDef datetime_methods[] = {
72557270
DATETIME_DATETIME___REDUCE_EX___METHODDEF
72567271
DATETIME_DATETIME___REDUCE___METHODDEF
72577272

7273+
{"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS,
7274+
PyDoc_STR("See PEP 585")},
7275+
72587276
{NULL, NULL}
72597277
};
72607278

0 commit comments

Comments
 (0)