summaryrefslogtreecommitdiff
path: root/Objects/stringlib
Commit message (Collapse)AuthorAgeFilesLines
* locale grouping strings should end in '\0'Benjamin Peterson2010-06-071-1/+1
|
* Untabify C files. Will watch buildbots.Antoine Pitrou2010-05-091-89/+89
|
* Issue #6902: Fix problem with built-in types format incorrectly with 0 padding.Eric Smith2010-02-231-4/+7
|
* Issue #7988: Fix default alignment to be right aligned for ↵Eric Smith2010-02-221-10/+40
| | | | complex.__format__. Now it matches other numeric types.
* Add note about usage of STRINGLIB_EMPTY.Georg Brandl2010-01-171-4/+5
|
* Sanitize bloom filter macrosAntoine Pitrou2010-01-131-11/+23
|
* Test commit to try to diagnose failures of the IA-64 buildbotAntoine Pitrou2010-01-131-2/+2
|
* Issue #7622: Improve the split(), rsplit(), splitlines() and replace()Antoine Pitrou2010-01-1310-196/+504
| | | | | methods of bytes, bytearray and unicode objects by using a common implementation based on stringlib's fast search. Patch by Florent Xicluna.
* Issue #7462: Implement the stringlib fast search algorithm for the `rfind`,Antoine Pitrou2010-01-026-86/+94
| | | | `rindex`, `rsplit` and `rpartition` methods. Patch by Florent Xicluna.
* Issue #3382: Make '%F' and float.__format__('F') convert results to upper ↵Eric Smith2009-11-291-14/+0
| | | | case. Much of the patch came from Mark Dickinson.
* Issue #7117, continued: Remove substitution of %g-style formatting forMark Dickinson2009-11-231-6/+0
| | | | | %f-style formatting, which used to occur at high precision. Float formatting should now be consistent between 2.7 and 3.1.
* Issue 6330: Fix --enable-unicode=ucs4.Eric Smith2009-07-301-3/+20
|
* Sync trunk and py3k versions of string formatting. Will manually merge into ↵Eric Smith2009-07-271-0/+6
| | | | py3k.
* Issue 6089: str.format raises SystemError.Eric Smith2009-05-231-2/+3
|
* Issue #5920: Changed format.__float__ and complex.__float__ to use a ↵Eric Smith2009-05-051-4/+8
| | | | precision of 12 when using the empty presentation type. This more closely matches str()'s behavior and reduces surprises when adding alignment flags to an empty format string. Patch by Mark Dickinson.
* Keep py3k and trunk code in sync.Eric Smith2009-05-021-0/+4
|
* #5889: remove comma at the end of a list that some C compilers don't like.Georg Brandl2009-05-011-1/+1
|
* Issue #1588: Add complex.__format__.Eric Smith2009-04-301-49/+334
|
* Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to ↵Eric Smith2009-04-271-11/+2
| | | | py3k. Should fix Windows buildbot errors.
* Fixed issue 5782: formatting with commas didn't work if no specifier type ↵Eric Smith2009-04-221-0/+1
| | | | code was given.
* Backport of some of the work in r71665 to trunk. This reworks much ofEric Smith2009-04-223-443/+676
| | | | | | | | | | | | | | | | | | | | | int, long, and float __format__(), and it keeps their implementation in sync with py3k. Also added PyOS_double_to_string. This is the "fallback" version that's also available in trunk, and should be kept in sync with that code. I'll add an issue to document PyOS_double_to_string in the C API. There are many internal cleanups. Externally visible changes include: - Implement PEP 378, Format Specifier for Thousands Separator, for floats, ints, and longs. - Issue #5515: 'n' formatting for ints, longs, and floats handles leading zero formatting poorly. - Issue #5772: For float.__format__, don't add a trailing ".0" if we're using no type code and we have an exponent.
* Fixed incorrect object passed into format_float_internal(). This was ↵Eric Smith2009-04-131-1/+1
| | | | resulting in a conversion being done twice.
* Issue #532631: Replace confusing fabs(x)/1e25 >= 1e25 testMark Dickinson2009-03-291-1/+1
| | | | with fabs(x) >= 1e50, and fix documentation.
* Issue 5237, Allow auto-numbered replacement fields in str.format() strings.Eric Smith2009-03-141-44/+129
| | | | | | | | | | | | | | | | | 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 #5247: Improve error message when unknown format codes are used when ↵Eric Smith2009-02-201-17/+31
| | | | using str.format() with str, unicode, long, int, and float arguments.
* fix urlBenjamin Peterson2009-01-201-1/+1
|
* Issue #4935: The overflow checking code in the expandtabs() method commonAntoine Pitrou2009-01-131-37/+30
| | | | | to str, bytes and bytearray could be optimized away by the compiler, letting the interpreter segfault instead of raising an error.
* #3967: Correct a crash in count() and find() methods of string-like objects.Amaury Forgeot d'Arc2008-09-262-8/+6
| | | | | | | | For example: "".count("xxxx", sys.maxint, 0) Reviewed by Benjamin Peterson. Will port to 2.5 and 3.0.
* Fix:Neal Norwitz2008-08-241-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | * crashes on memory allocation failure found with failmalloc * memory leaks found with valgrind * compiler warnings in opt mode which would lead to invalid memory reads * problem using wrong name in decimal module reported by pychecker Update the valgrind suppressions file with new leaks that are small/one-time leaks we don't care about (ie, they are too hard to fix). TBR=barry TESTED=./python -E -tt ./Lib/test/regrtest.py -uall (both debug and opt modes) in opt mode: valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \ ./python -E -tt ./Lib/test/regrtest.py -uall,-bsddb,-compiler \ -x test_logging test_ssl test_multiprocessing valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \ ./python -E -tt ./Lib/test/regrtest.py test_multiprocessing for i in `seq 1 4000` ; do LD_PRELOAD=~/local/lib/libfailmalloc.so FAILMALLOC_INTERVAL=$i \ ./python -c pass done At least some of these fixes should probably be backported to 2.5.
* Silenced compiler warningChristian Heimes2008-08-221-1/+1
| | | | | Objects/stringlib/find.h:97: warning: 'stringlib_contains_obj' defined but not used Reviewed by Benjamin Peterson
* Backport of r63826.Eric Smith2008-08-181-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.
* Backed out r65069, pending fixing it in Windows.Eric Smith2008-07-171-6/+6
|
* Issue 3382: Make '%F' and float.__format__('F') convert results to upper case.Eric Smith2008-07-171-6/+6
|
* Renamed a parameter in calc_number_widths, for consistency with the same ↵Eric Smith2008-07-161-32/+32
| | | | parameter in fill_non_digits.
* Complete issue 3083: add alternate (#) formatting to bin, oct, hex in ↵Eric Smith2008-07-161-30/+68
| | | | str.format().
* Added '#' formatting to integers. This adds the 0b, 0o, or 0x prefix for ↵Eric Smith2008-07-151-13/+43
| | | | bin, oct, hex. There's still one failing case, and I need to finish the docs. I hope to finish those today.
* Fixed formatting with thousands separator and padding. Resolves issue 3140.Eric Smith2008-06-241-13/+13
|
* Typo in comment.Eric Smith2008-06-241-1/+1
|
* Modified interface to _Py_[String|Unicode]InsertThousandsGrouping, in ↵Eric Smith2008-06-242-20/+27
| | | | anticipation of fixing issue 3140.
* This reverts r63675 based on the discussion in this thread:Gregory P. Smith2008-06-092-8/+8
| | | | | | | 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.
* Refactor and clean up str.format() code (and helpers) in advance of ↵Eric Smith2008-05-301-69/+47
| | | | optimizations.
* Renamed PyString to PyBytesChristian Heimes2008-05-263-9/+9
|
* Addresses issue 2802: 'n' formatting for integers.Eric Smith2008-05-114-3/+150
| | | | | | | | | | | | | | Adds 'n' as a format specifier for integers, to mirror the same specifier which is already available for floats. 'n' is the same as 'd', but inserts the current locale-specific thousands grouping. I added this as a stringlib function, but it's only used by str type, not unicode. This is because of an implementation detail in unicode.format(), which does its own str->unicode conversion. But the unicode version will be needed in 3.0, and it may be needed by other code eventually in 2.6 (maybe decimal?), so I left it as a stringlib implementation. As long as the unicode version isn't instantiated, there's no overhead for this.
* Bug #2388: Fix gcc warnings when compiling with --enable-unicode=ucs4.Martin v. Löwis2008-04-072-5/+24
|
* Merged revisions ↵Christian Heimes2008-03-262-0/+472
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 61750,61752,61754,61756,61760,61763,61768,61772,61775,61805,61809,61812,61819,61917,61920,61930,61933-61934 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/trunk-bytearray ........ r61750 | christian.heimes | 2008-03-22 20:47:44 +0100 (Sat, 22 Mar 2008) | 1 line Copied files from py3k w/o modifications ........ r61752 | christian.heimes | 2008-03-22 20:53:20 +0100 (Sat, 22 Mar 2008) | 7 lines Take One * Added initialization code, warnings, flags etc. to the appropriate places * Added new buffer interface to string type * Modified tests * Modified Makefile.pre.in to compile the new files * Added bytesobject.c to Python.h ........ r61754 | christian.heimes | 2008-03-22 21:22:19 +0100 (Sat, 22 Mar 2008) | 2 lines Disabled bytearray.extend for now since it causes an infinite recursion Fixed serveral unit tests ........ r61756 | christian.heimes | 2008-03-22 21:43:38 +0100 (Sat, 22 Mar 2008) | 5 lines Added PyBytes support to several places: str + bytearray ord(bytearray) bytearray(str, encoding) ........ r61760 | christian.heimes | 2008-03-22 21:56:32 +0100 (Sat, 22 Mar 2008) | 1 line Fixed more unit tests related to type('') is not unicode ........ r61763 | christian.heimes | 2008-03-22 22:20:28 +0100 (Sat, 22 Mar 2008) | 2 lines Fixed more unit tests Fixed bytearray.extend ........ r61768 | christian.heimes | 2008-03-22 22:40:50 +0100 (Sat, 22 Mar 2008) | 1 line Implemented old buffer interface for bytearray ........ r61772 | christian.heimes | 2008-03-22 23:24:52 +0100 (Sat, 22 Mar 2008) | 1 line Added backport of the io module ........ r61775 | christian.heimes | 2008-03-23 03:50:49 +0100 (Sun, 23 Mar 2008) | 1 line Fix str assignement to bytearray. Assignment of a str of size 1 is interpreted as a single byte ........ r61805 | christian.heimes | 2008-03-23 19:33:48 +0100 (Sun, 23 Mar 2008) | 3 lines Fixed more tests Fixed bytearray() comparsion with unicode() Fixed iterator assignment of bytearray ........ r61809 | christian.heimes | 2008-03-23 21:02:21 +0100 (Sun, 23 Mar 2008) | 2 lines str(bytesarray()) now returns the bytes and not the representation of the bytearray object Enabled and fixed more unit tests ........ r61812 | christian.heimes | 2008-03-23 21:53:08 +0100 (Sun, 23 Mar 2008) | 3 lines Clear error PyNumber_AsSsize_t() fails Use CHARMASK for ob_svall access disabled a test with memoryview again ........ r61819 | christian.heimes | 2008-03-23 23:05:57 +0100 (Sun, 23 Mar 2008) | 1 line Untested updates to the PCBuild directory ........ r61917 | christian.heimes | 2008-03-26 00:57:06 +0100 (Wed, 26 Mar 2008) | 1 line The type system of Python 2.6 has subtle differences to 3.0's. I've removed the Py_TPFLAGS_BASETYPE flags from bytearray for now. bytearray can't be subclasses until the issues with bytearray subclasses are fixed. ........ r61920 | christian.heimes | 2008-03-26 01:44:08 +0100 (Wed, 26 Mar 2008) | 2 lines Disabled last failing test I don't understand what the test is testing and how it suppose to work. Ka-Ping, please check it out. ........ r61930 | christian.heimes | 2008-03-26 12:46:18 +0100 (Wed, 26 Mar 2008) | 1 line Re-enabled bytes warning code ........ r61933 | christian.heimes | 2008-03-26 13:20:46 +0100 (Wed, 26 Mar 2008) | 1 line Fixed a bug in the new buffer protocol. The buffer slots weren't copied into a subclass. ........ r61934 | christian.heimes | 2008-03-26 13:25:09 +0100 (Wed, 26 Mar 2008) | 1 line Re-enabled bytearray subclassing - all tests are passing. ........
* Issue 2264: empty float presentation type needs to have at least one digit ↵Eric Smith2008-03-171-1/+6
| | | | | | | | | past the decimal point. Added "Z" format_char to PyOS_ascii_formatd to support empty float presentation type. Renamed buf_size in PyOS_ascii_formatd to more accurately reflect it's meaning. Modified format.__float__ to use the new "Z" format as the default. Added test cases.
* Corrected assert to check for correct type in py3k.Eric Smith2008-02-241-1/+1
|
* Now that PyOS_ascii_formatd supports the 'n' format, simplify the float ↵Eric Smith2008-02-201-40/+15
| | | | formatting code to just call it.
* Added code to correct combining str and unicode in ''.format(). Added test ↵Eric Smith2008-02-181-0/+16
| | | | case.
* Backport of PEP 3101, Advanced String Formatting, from py3k.Eric Smith2008-02-174-0/+2273
| | | | | | | | | | | | | | | 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).