summaryrefslogtreecommitdiffstats
path: root/Objects/stringlib/string_format.h
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases ↵Christian Heimes2007-12-021-3/+3
| | | | in intobject.h
* Replace PyObject_Unicode with PyObject_Str everywhere, and remove theThomas Heller2007-11-151-1/+1
| | | | #define for PyObject_Unicode in object.h.
* Simplified recursion logic. Modified variable name to match string.Formatter.Eric Smith2007-09-051-12/+10
|
* Changed some ValueError's to KeyError and IndexError.Eric Smith2007-09-041-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.
* Fix segfault discovered by Ron Adam. Not checking for terminating right ↵Eric Smith2007-09-031-4/+10
| | | | bracket in "'{0[}'.format(())". Fixed, and tests added.
* Modified parsing of format strings, so that we always returnEric Smith2007-08-291-155/+157
| | | | | | | | | | | | | | | | | | 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.
* Simplified tuple returned by string._formatter_parser to only haveEric Smith2007-08-281-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.
* Code layout changes for PEP 7 compliance.Eric Smith2007-08-281-14/+21
|
* Moved fieldnameiterator and formatteriterator to stringlib/string_format.h, ↵Eric Smith2007-08-271-0/+345
| | | | so that they can be used when backporting to 2.6.
* Cleanup in anticipation of moving formatteriterator and fieldnameiterator ↵Eric Smith2007-08-271-23/+7
| | | | into stringlib/string_format.h.
* Fix refleaks in test_unicode and test_string related to the new format code.Neal Norwitz2007-08-271-0/+1
| | | | Stop polluting namespace.
* This adds a leak, but fixes a crash. The leaking code is:Neal Norwitz2007-08-271-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.
* PEP 3101: Completed string.Formatter class. Reimplemented field_name to ↵Eric Smith2007-08-261-165/+260
| | | | object transformation.
* Get rid of compiler warning on 64-bitNeal Norwitz2007-08-251-4/+8
|
* Implementation of PEP 3101, Advanced String Formatting.Eric Smith2007-08-251-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.