summaryrefslogtreecommitdiff
path: root/Objects/stringlib/string_format.h
AgeCommit message (Collapse)AuthorLines
2008-08-18Backport of r63826.Eric Smith-6/+42
Optimization of str.format() for cases with str, unicode, int, long, and float arguments. This gives about 30% speed improvement for the simplest (but most common) cases. This patch skips the __format__ dispatch, and also avoids creating an object to hold the format_spec. Unfortunately there's a complication in 2.6 with int, long, and float because they always expect str format_specs. So in the unicode version of this optimization, just check for unicode objects. int, float, long, and str can be added later, if needed.
2008-06-09This reverts r63675 based on the discussion in this thread:Gregory P. Smith-1/+1
http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread.
2008-05-26Renamed PyString to PyBytesChristian Heimes-1/+1
2008-04-07Bug #2388: Fix gcc warnings when compiling with --enable-unicode=ucs4.Martin v. Löwis-3/+11
2008-02-24Corrected assert to check for correct type in py3k.Eric Smith-1/+1
2008-02-18Added code to correct combining str and unicode in ''.format(). Added test ↵Eric Smith-0/+16
case.
2008-02-17Backport of PEP 3101, Advanced String Formatting, from py3k.Eric Smith-0/+1214
Highlights: - Adding PyObject_Format. - Adding string.Format class. - Adding __format__ for str, unicode, int, long, float, datetime. - Adding builtin format. - Adding ''.format and u''.format. - str/unicode fixups for formatters. The files in Objects/stringlib that implement PEP 3101 (stringdefs.h, unicodedefs.h, formatter.h, string_format.h) are identical in trunk and py3k. Any changes from here on should be made to trunk, and changes will propogate to py3k).