39 Commits

Author SHA1 Message Date
Martin Panter
6507657ddd Issue #27895: Spelling fixes (Contributed by Ville Skyttä). 2016-09-07 12:03:06 +00:00
Martin Panter
4f23cabc16 Corrections for a/an in code comments and documentation 2016-05-08 13:45:55 +00:00
Victor Stinner
e192d0bbb9 Issue #7267: format(int, 'c') now raises OverflowError when the argument is not
in range(0, 256).
2015-11-09 12:21:09 +01:00
Eric V. Smith
9a55cd8857 Issue #12546: Allow \x00 as a fill character for builtin type __format__ methods. 2014-04-14 11:22:33 -04:00
Victor Stinner
760388100e Issue #18137: Detect integer overflow on precision in float.__format__()
and complex.__format__().
2013-06-23 14:56:57 +02:00
Mark Dickinson
75d3600466 Issue #14700: Fix buggy overflow checks for large precision and width in new-style and old-style formatting. 2012-10-28 10:00:46 +00:00
Mark Dickinson
aad57bd1bb Merged revisions 83400 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83400 | mark.dickinson | 2010-08-01 11:41:49 +0100 (Sun, 01 Aug 2010) | 7 lines

  Issue #9416: Fix some issues with complex formatting where the
  output with no type specifier failed to match the str output:

    - format(complex(-0.0, 2.0), '-') omitted the real part from the output,
    - format(complex(0.0, 2.0), '-') included a sign and parentheses.
........
2010-08-01 10:45:15 +00:00
Benjamin Peterson
7dbe3e31c1 remove extra byte and fix comment 2010-06-07 22:32:44 +00:00
Benjamin Peterson
c4afe2950a locale grouping strings should end in '\0' 2010-06-07 21:37:09 +00:00
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
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
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
Eric Smith
9139cc6a3b Issue #1588: Add complex.__format__. 2009-04-30 00:58:58 +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
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
Neal Norwitz
18aa388ca0 Fix:
* 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.
2008-08-24 05:04:52 +00:00
Eric Smith
d6c393ab2b Backed out r65069, pending fixing it in Windows. 2008-07-17 19:49:47 +00:00