Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a crash in t-string iteration when creating the iterator fails partway through due to memory pressure.
4 changes: 3 additions & 1 deletion Objects/templateobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ template_iter(PyObject *op)
if (iter == NULL) {
return NULL;
}
iter->stringsiter = NULL;
iter->interpolationsiter = NULL;
iter->from_strings = 1;

PyObject *stringsiter = PyObject_GetIter(self->strings);
if (stringsiter == NULL) {
Expand All @@ -242,7 +245,6 @@ template_iter(PyObject *op)

iter->stringsiter = stringsiter;
iter->interpolationsiter = interpolationsiter;
iter->from_strings = 1;
PyObject_GC_Track(iter);
return (PyObject *)iter;
}
Expand Down
Loading