aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Objects/templateobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/templateobject.c')
-rw-r--r--Objects/templateobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/templateobject.c b/Objects/templateobject.c
index 7d356980b56..4293a311c44 100644
--- a/Objects/templateobject.c
+++ b/Objects/templateobject.c
@@ -23,6 +23,9 @@ templateiter_next(PyObject *op)
if (self->from_strings) {
item = PyIter_Next(self->stringsiter);
self->from_strings = 0;
+ if (item == NULL) {
+ return NULL;
+ }
if (PyUnicode_GET_LENGTH(item) == 0) {
Py_SETREF(item, PyIter_Next(self->interpolationsiter));
self->from_strings = 1;
@@ -444,6 +447,8 @@ template_reduce(PyObject *op, PyObject *Py_UNUSED(dummy))
static PyMethodDef template_methods[] = {
{"__reduce__", template_reduce, METH_NOARGS, NULL},
+ {"__class_getitem__", Py_GenericAlias,
+ METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
{NULL, NULL},
};