summaryrefslogtreecommitdiff
path: root/Objects/stringlib/string_format.h
AgeCommit message (Collapse)AuthorLines
2012-10-28Issue #14700: Fix buggy overflow checks for large precision and width in ↵Mark Dickinson-9/+6
new-style and old-style formatting.
2011-07-18Closes #12579. Positional fields with str.format_map() now raise a ↵Eric V. Smith-0/+10
ValueError instead of SystemError.
2011-03-15#11515: Merge with 3.1.Ezio Melotti-1/+1
2011-03-15#11515: fix several typos. Patch by Piotr Kasprzyk.Ezio Melotti-1/+1
2011-01-29Issue #11302: missing type check on _string.formatter_field_name_split and ↵Eric Smith-0/+10
_string.formatter_parser caused crash. Originial patch by haypo, reviewed by me, okayed by Georg.
2010-11-05Followup to r86170: fix reference leak in str.formatAntoine Pitrou-1/+0
2010-11-04Issue #6081: Add str.format_map. str.format_map(mapping) is similar to ↵Eric Smith-1/+10
str.format(**mapping), except mapping does not get converted to a dict.
2010-10-14#9418: first step of moving private string methods to _string module.Georg Brandl-2/+2
2010-06-08Merged revisions 81823,81835 via svnmerge fromBenjamin Peterson-0/+4
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r81823 | benjamin.peterson | 2010-06-07 17:31:26 -0500 (Mon, 07 Jun 2010) | 9 lines 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 ........ ................ r81835 | benjamin.peterson | 2010-06-08 09:57:22 -0500 (Tue, 08 Jun 2010) | 9 lines Merged revisions 81834 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r81834 | benjamin.peterson | 2010-06-08 09:53:29 -0500 (Tue, 08 Jun 2010) | 1 line kill extra word ........ ................
2010-06-07Merged revisions 81820 via svnmerge fromBenjamin Peterson-0/+4
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 ........
2010-05-09Recorded merge of revisions 81032 via svnmerge fromAntoine Pitrou-86/+86
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines Recorded merge of revisions 81029 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........ ................
2010-05-09Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou-86/+86
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
2009-05-23Merged revisions 72848 via svnmerge fromEric Smith-2/+3
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72848 | eric.smith | 2009-05-23 09:56:13 -0400 (Sat, 23 May 2009) | 1 line Issue 6089: str.format raises SystemError. ........
2009-05-01Merged revisions 72159 via svnmerge fromGeorg Brandl-1/+1
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72159 | georg.brandl | 2009-05-01 10:51:37 +0200 (Fr, 01 Mai 2009) | 2 lines #5889: remove comma at the end of a list that some C compilers don't like. ........
2009-03-14Merged revisions 70364 via svnmerge fromEric Smith-44/+129
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70364 | eric.smith | 2009-03-14 07:57:26 -0400 (Sat, 14 Mar 2009) | 17 lines Issue 5237, Allow auto-numbered replacement fields in str.format() strings. For simple uses for str.format(), this makes the typing easier. Hopfully this will help in the adoption of str.format(). For example: 'The {} is {}'.format('sky', 'blue') You can mix and matcth auto-numbering and named replacement fields: 'The {} is {color}'.format('sky', color='blue') But you can't mix and match auto-numbering and specified numbering: 'The {0} is {}'.format('sky', 'blue') ValueError: cannot switch from manual field specification to automatic field numbering Will port to 3.1. ........
2009-02-02Issue #1717: rename tp_compare to tp_reserved. I'll change theMark Dickinson-2/+2
type of tp_compare in a separate commit, for ease of reversion should things go wrong.
2008-06-11#2630: Implement PEP 3138.Georg Brandl-0/+4
The repr() of a string now contains printable Unicode characters unescaped. The new ascii() builtin can be used to get a repr() with only ASCII characters in it. PEP and patch were written by Atsuo Ishimoto.
2008-06-02Refactored known type optimization, in anticipation of backporting to 2.6. ↵Eric Smith-7/+13
I'll probably move this code into PyObject_Format, so everyone benefits.
2008-05-31Optimization of str.format() for cases with unicode, long, and floatEric Smith-6/+27
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, backporting this to 2.6 is going to be more challenging due to str/unicode issues with format_spec. I'll work on that next. Then I'll spend some time profiling and see what that tells me.
2008-05-26Renamed PyString to PyBytesChristian Heimes-1/+1
2008-04-07Merged revisions 62199 via svnmerge fromMartin v. Löwis-3/+11
svn+ssh://pythondev@svn.python.org/python/trunk ........ r62199 | martin.v.loewis | 2008-04-07 05:08:28 +0200 (Mo, 07 Apr 2008) | 2 lines Bug #2388: Fix gcc warnings when compiling with --enable-unicode=ucs4. ........
2008-02-24Corrected assert to check for correct type in py3k.Eric Smith-1/+1
2008-02-18Port 60893 to py3k, without unicode test.Eric Smith-0/+16
2008-02-17Fixes for shared 2.6 code that implements PEP 3101, advanced stringEric Smith-72/+24
formatting. Includes: - Modifying tests for basic types to use __format__ methods, instead of builtin "format". - Adding PyObject_Format. - General str/unicode cleanup discovered when backporting to 2.6. - Removing datetimemodule.c's time_format, since it was identical to date_format. 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).
2007-12-19#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.Christian Heimes-4/+4
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.