diff --git a/Objects/stringlib/string_format.h b/Objects/stringlib/string_format.h index 2799141f32a..4ae7e578f24 100644 --- a/Objects/stringlib/string_format.h +++ b/Objects/stringlib/string_format.h @@ -416,6 +416,7 @@ get_field_object(SubString *input, PyObject *args, PyObject *kwargs) Py_DECREF(key); goto error; } + Py_INCREF(obj); } else { /* look up in args */ obj = PySequence_GetItem(args, index);