diff options
author | Eric V. Smith <eric@trueblade.com> | 2011-07-18 18:08:55 (GMT) |
---|---|---|
committer | Eric V. Smith <eric@trueblade.com> | 2011-07-18 18:08:55 (GMT) |
commit | c12469df227a7ec8a268c9a6dae4f52c70c0635a (patch) | |
tree | 6e803338b7602f564998ae57f5d670f7bf93a760 /Objects | |
parent | 677b6530b024d905f094908f6519a0316cde5d77 (diff) | |
parent | 12ebefc9d3b7268d17d4a042767f712c46d03dfe (diff) | |
download | cpython-c12469df227a7ec8a268c9a6dae4f52c70c0635a.zip cpython-c12469df227a7ec8a268c9a6dae4f52c70c0635a.tar.gz cpython-c12469df227a7ec8a268c9a6dae4f52c70c0635a.tar.bz2 |
Merge from 3.2.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/stringlib/string_format.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Objects/stringlib/string_format.h b/Objects/stringlib/string_format.h index 6f10727..6c7adcb 100644 --- a/Objects/stringlib/string_format.h +++ b/Objects/stringlib/string_format.h @@ -511,6 +511,16 @@ get_field_object(SubString *input, PyObject *args, PyObject *kwargs, Py_DECREF(key); } else { + /* If args is NULL, we have a format string with a positional field + with only kwargs to retrieve it from. This can only happen when + used with format_map(), where positional arguments are not + allowed. */ + if (args == NULL) { + PyErr_SetString(PyExc_ValueError, "Format string contains " + "positional fields"); + goto error; + } + /* look up in args */ obj = PySequence_GetItem(args, index); if (obj == NULL) |