summaryrefslogtreecommitdiff
path: root/Objects/stringlib/string_format.h
AgeCommit message (Collapse)AuthorLines
2007-12-02Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases ↵Christian Heimes-3/+3
in intobject.h
2007-11-15Replace PyObject_Unicode with PyObject_Str everywhere, and remove theThomas Heller-1/+1
#define for PyObject_Unicode in object.h.
2007-09-05Simplified recursion logic. Modified variable name to match string.Formatter.Eric Smith-12/+10
2007-09-04Changed some ValueError's to KeyError and IndexError.Eric Smith-7/+2
Corrected code for invalid conversion specifier. Added tests to verify. Modified string.Formatter to correctly expand format_spec's, and added a limit to recursion depth. Added _vformat() method to support both of these.
2007-09-03Fix segfault discovered by Ron Adam. Not checking for terminating right ↵Eric Smith-4/+10
bracket in "'{0[}'.format(())". Fixed, and tests added.
2007-08-29Modified parsing of format strings, so that we always returnEric Smith-149/+151
a tuple (literal, field_name, format_spec, conversion). literal will always be a string, but might be of zero length. field_name will be None if there is no markup text format_spec will be a (possibly zero length) string if field_name is non-None conversion will be a one character string, or None This makes the Formatter class, and especially it's parse() method, easier to understand. Suggestion was by Jim Jewett, inspired by the "tail" of an elementtree node. Also, fixed a reference leak in fieldnameiter_next.
2007-08-28Simplified tuple returned by string._formatter_parser to only haveEric Smith-8/+1
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.
2007-08-28Code layout changes for PEP 7 compliance.Eric Smith-14/+21
2007-08-27Moved fieldnameiterator and formatteriterator to stringlib/string_format.h, ↵Eric Smith-0/+345
so that they can be used when backporting to 2.6.
2007-08-27Cleanup in anticipation of moving formatteriterator and fieldnameiterator ↵Eric Smith-23/+7
into stringlib/string_format.h.
2007-08-27Fix refleaks in test_unicode and test_string related to the new format code.Neal Norwitz-0/+1
Stop polluting namespace.
2007-08-27This adds a leak, but fixes a crash. The leaking code is:Neal Norwitz-0/+1
"{0:.{precision}s}".format('hello world', precision=5) I pretty sure it's because of the 'precision' keyword. Still need to investigate further.
2007-08-26PEP 3101: Completed string.Formatter class. Reimplemented field_name to ↵Eric Smith-165/+260
object transformation.
2007-08-25Get rid of compiler warning on 64-bitNeal Norwitz-4/+8
2007-08-25Implementation of PEP 3101, Advanced String Formatting.Eric Smith-0/+831
Known issues: The string.Formatter class, as discussed in the PEP, is incomplete. Error handling needs to conform to the PEP. Need to fix this warning that I introduced in Python/formatter_unicode.c: Objects/stringlib/unicodedefs.h:26: warning: `STRINGLIB_CMP' defined but not used Need to make sure sign formatting is correct, more tests needed. Need to remove '()' sign formatting, left over from an earlier version of the PEP.