Mercurial > cpython-lru_cache-weakref
diff Objects/stringlib/string_format.h @ 62170:b44a2fe531ef 2.6
Merged revisions 81820 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81820 | benjamin.peterson | 2010-06-07 17:23:23 -0500 (Mon, 07 Jun 2010) | 1 line
correctly overflow when indexes are too large
........
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Mon, 07 Jun 2010 22:27:32 +0000 |
| parents | e38335d4df91 |
| children | b36cb4602e21 |
line wrap: on
line diff
--- a/Objects/stringlib/string_format.h Mon Jun 07 22:04:54 2010 +0000 +++ b/Objects/stringlib/string_format.h Mon Jun 07 22:27:32 2010 +0000 @@ -327,6 +327,8 @@ if (_FieldNameIterator_item(self, name) == 0) return 0; *name_idx = get_integer(name); + if (*name_idx == -1 && PyErr_Occurred()) + return 0; break; default: /* Invalid character follows ']' */ @@ -380,6 +382,8 @@ /* see if "first" is an integer, in which case it's used as an index */ *first_idx = get_integer(first); + if (*first_idx == -1 && PyErr_Occurred()) + return 0; /* zero length string is an error */ if (first->ptr >= first->end) {
