diff options
author | Eric Smith <eric@trueblade.com> | 2007-08-28 11:15:20 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2007-08-28 11:15:20 (GMT) |
commit | 9e7c8da61c01279797197438111c33b3b8f2e3b2 (patch) | |
tree | 7317ed891aa64e0d799b614108154abcdb3c542d /Objects | |
parent | 79710cdea1975c633c63bb25b25f92ac61a976e2 (diff) | |
download | cpython-9e7c8da61c01279797197438111c33b3b8f2e3b2.zip cpython-9e7c8da61c01279797197438111c33b3b8f2e3b2.tar.gz cpython-9e7c8da61c01279797197438111c33b3b8f2e3b2.tar.bz2 |
Simplified tuple returned by string._formatter_parser to only have
4 elements. No need for old is_markup element, the same information
is indicated by literal_string being None.
Factored string.Formatter class to make subclasses easier to write.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/stringlib/string_format.h | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/Objects/stringlib/string_format.h b/Objects/stringlib/string_format.h index 44c5442..b8ea03f 100644 --- a/Objects/stringlib/string_format.h +++ b/Objects/stringlib/string_format.h @@ -979,17 +979,12 @@ formatteriter_next(formatteriterobject *it) /* if 0, error has already been set, if 1, iterator is empty */ return NULL; else { - PyObject *is_markup_bool = NULL; PyObject *literal_str = NULL; PyObject *field_name_str = NULL; PyObject *format_spec_str = NULL; PyObject *conversion_str = NULL; PyObject *tuple = NULL; - is_markup_bool = PyBool_FromLong(is_markup); - if (!is_markup_bool) - return NULL; - if (is_markup) { /* field_name, format_spec, and conversion are returned */ literal_str = Py_None; @@ -1030,11 +1025,9 @@ formatteriter_next(formatteriterobject *it) Py_INCREF(format_spec_str); Py_INCREF(conversion_str); } - tuple = PyTuple_Pack(5, is_markup_bool, literal_str, - field_name_str, format_spec_str, + tuple = PyTuple_Pack(4, literal_str, field_name_str, format_spec_str, conversion_str); error: - Py_XDECREF(is_markup_bool); Py_XDECREF(literal_str); Py_XDECREF(field_name_str); Py_XDECREF(format_spec_str); |