summaryrefslogtreecommitdiffstats
path: root/Objects/stringlib/string_format.h
Commit message (Collapse)AuthorAgeFilesLines
* Implement PEP 393.Martin v. Löwis2011-09-281-1385/+0
|
* Issue #1621: Fix undefined behaviour from signed overflow in datetime module ↵Mark Dickinson2011-09-251-8/+6
| | | | hashes, array and list iterations, and get_integer (stringlib/string_format.h)
* Closes #12579. Positional fields with str.format_map() now raise a ↵Eric V. Smith2011-07-181-0/+10
| | | | ValueError instead of SystemError.
* #11515: Merge with 3.1.Ezio Melotti2011-03-151-1/+1
|\
| * #11515: fix several typos. Patch by Piotr Kasprzyk.Ezio Melotti2011-03-151-1/+1
| |
| * Merged revisions 81823,81835 via svnmerge fromBenjamin Peterson2010-06-081-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 ........ ................
| * Recorded merge of revisions 81032 via svnmerge fromAntoine Pitrou2010-05-091-87/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. ........ ................
* | Issue #11302: missing type check on _string.formatter_field_name_split and ↵Eric Smith2011-01-291-0/+10
| | | | | | | | | | | | _string.formatter_parser caused crash. Originial patch by haypo, reviewed by me, okayed by Georg.
* | Followup to r86170: fix reference leak in str.formatAntoine Pitrou2010-11-051-1/+0
| |
* | Issue #6081: Add str.format_map. str.format_map(mapping) is similar to ↵Eric Smith2010-11-041-1/+10
| | | | | | | | str.format(**mapping), except mapping does not get converted to a dict.
* | #9418: first step of moving private string methods to _string module.Georg Brandl2010-10-141-2/+2
| |
* | Merged revisions 81820 via svnmerge fromBenjamin Peterson2010-06-071-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 ........
* | Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou2010-05-091-87/+87
|/ | | | | | | | | | 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. ........
* Merged revisions 72848 via svnmerge fromEric Smith2009-05-231-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. ........
* Merged revisions 72159 via svnmerge fromGeorg Brandl2009-05-011-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. ........
* Merged revisions 70364 via svnmerge fromEric Smith2009-03-141-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. ........
* Issue #1717: rename tp_compare to tp_reserved. I'll change theMark Dickinson2009-02-021-2/+2
| | | | | type of tp_compare in a separate commit, for ease of reversion should things go wrong.
* #2630: Implement PEP 3138.Georg Brandl2008-06-111-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.
* Refactored known type optimization, in anticipation of backporting to 2.6. ↵Eric Smith2008-06-021-7/+13
| | | | I'll probably move this code into PyObject_Format, so everyone benefits.
* Optimization of str.format() for cases with unicode, long, and floatEric Smith2008-05-311-7/+28
| | | | | | | | | | | 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.
* Renamed PyString to PyBytesChristian Heimes2008-05-261-1/+1
|
* Merged revisions 62199 via svnmerge fromMartin v. Löwis2008-04-071-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. ........
* Corrected assert to check for correct type in py3k.Eric Smith2008-02-241-1/+1
|
* Port 60893 to py3k, without unicode test.Eric Smith2008-02-181-0/+16
|
* Fixes for shared 2.6 code that implements PEP 3101, advanced stringEric Smith2008-02-171-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).
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.Christian Heimes2007-12-191-4/+4
|
* 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.