Commit Graph

65 Commits

Author SHA1 Message Date
Eric Smith
87bcb243ac Issue #6902: Fix problem with built-in types format incorrectly with 0 padding. 2010-02-23 00:11:16 +00:00
Eric Smith
f32d4acead Issue #7988: Fix default alignment to be right aligned for complex.__format__. Now it matches other numeric types. 2010-02-22 18:33:47 +00:00
Georg Brandl
aee900338e Add note about usage of STRINGLIB_EMPTY. 2010-01-17 12:14:42 +00:00
Antoine Pitrou
10042922d9 Sanitize bloom filter macros 2010-01-13 14:01:26 +00:00
Antoine Pitrou
a913a20c91 Test commit to try to diagnose failures of the IA-64 buildbot 2010-01-13 13:43:37 +00:00
Antoine Pitrou
6467213bfd Issue #7622: Improve the split(), rsplit(), splitlines() and replace()
methods of bytes, bytearray and unicode objects by using a common
implementation based on stringlib's fast search.  Patch by Florent Xicluna.
2010-01-13 07:55:48 +00:00
Antoine Pitrou
5b7139aab4 Issue #7462: Implement the stringlib fast search algorithm for the rfind,
`rindex`, `rsplit` and `rpartition` methods.  Patch by Florent Xicluna.
2010-01-02 21:12:58 +00:00
Eric Smith
c4ab8339e9 Issue #3382: Make '%F' and float.__format__('F') convert results to upper case. Much of the patch came from Mark Dickinson. 2009-11-29 17:40:57 +00:00
Mark Dickinson
9dd5e16c5d Issue #7117, continued: Remove substitution of %g-style formatting for
%f-style formatting, which used to occur at high precision.  Float formatting
should now be consistent between 2.7 and 3.1.
2009-11-23 20:54:09 +00:00
Eric Smith
5c4a5d2911 Issue 6330: Fix --enable-unicode=ucs4. 2009-07-30 13:39:44 +00:00
Eric Smith
e94a826304 Sync trunk and py3k versions of string formatting. Will manually merge into py3k. 2009-07-27 01:58:25 +00:00
Eric Smith
4b94b192ff Issue 6089: str.format raises SystemError. 2009-05-23 13:56:13 +00:00
Eric Smith
a985a3aee4 Issue #5920: Changed format.__float__ and complex.__float__ to use a 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. 2009-05-05 18:26:08 +00:00
Eric Smith
27f204dc29 Keep py3k and trunk code in sync. 2009-05-02 09:58:09 +00:00
Georg Brandl
ca87fa5a5b #5889: remove comma at the end of a list that some C compilers don't like. 2009-05-01 08:51:37 +00:00
Eric Smith
9139cc6a3b Issue #1588: Add complex.__format__. 2009-04-30 00:58:58 +00:00
Eric Smith
cac7af6863 Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors. 2009-04-27 19:04:37 +00:00
Eric Smith
ebafbb705c Fixed issue 5782: formatting with commas didn't work if no specifier type code was given. 2009-04-22 16:20:47 +00:00
Eric Smith
aca19e6a74 Backport of some of the work in r71665 to trunk. This reworks much of
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.
2009-04-22 13:29:05 +00:00
Eric Smith
8c023248ed Fixed incorrect object passed into format_float_internal(). This was resulting in a conversion being done twice. 2009-04-13 00:29:50 +00:00
Mark Dickinson
2e648ecc7d Issue #532631: Replace confusing fabs(x)/1e25 >= 1e25 test
with fabs(x) >= 1e50, and fix documentation.
2009-03-29 14:37:51 +00:00
Eric Smith
6f42edb682 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-03-14 11:57:26 +00:00
Eric Smith
e9fb6863da Issue #5247: Improve error message when unknown format codes are used when using str.format() with str, unicode, long, int, and float arguments. 2009-02-20 14:02:36 +00:00
Benjamin Peterson
e548d2487d fix url 2009-01-20 18:58:27 +00:00
Antoine Pitrou
c2f02216b6 Issue #4935: The overflow checking code in the expandtabs() method common
to str, bytes and bytearray could be optimized away by the compiler, letting
the interpreter segfault instead of raising an error.
2009-01-13 23:13:52 +00:00