Commit Graph

20 Commits

Author SHA1 Message Date
Eric Smith f032a00271 Fix issue 3411: default float format spec fails on negative numbers. 2008-07-19 00:24:05 +00:00
Eric Smith 65fe47b931 Modified interface to _Py_[String|Unicode]InsertThousandsGrouping, in anticipation of fixing issue 3140. 2008-06-24 00:42:10 +00:00
Gregory P. Smith dd96db63f6 This reverts r63675 based on the discussion in this thread:
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.
2008-06-09 04:58:54 +00:00
Christian Heimes 593daf545b Renamed PyString to PyBytes 2008-05-26 12:51:38 +00:00
Eric Smith cf537ff39e Addresses issue 2802: 'n' formatting for integers.
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.
2008-05-11 19:52:48 +00:00
Eric Smith 0a95063d73 Issue 2526, float.__format__ 'n' specifier does not support thousands grouping.
Implemented grouping, with tests.
Cleaned up PyOS_ascii_formatd by breaking reformatting into smaller functions.
2008-04-30 01:09:30 +00:00
Eric Smith 5c35a9da65 Reformated lines > 79 chars.
Deleted unused macro ISXDIGIT.
2008-03-17 12:14:29 +00:00
Eric Smith 8113ca63b9 Issue 2264: empty float presentation type needs to have at least one digit 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.
2008-03-17 11:01:01 +00:00
Eric Smith 7ef40bf9c7 Trim leading zeros from a floating point exponent, per C99. See issue 1600. As far as I know, this only affects Windows. Add float type 'n' to PyOS_ascii_formatd (see PEP 3101 for 'n' description). 2008-02-20 23:34:22 +00:00
Guido van Rossum 3b83549ea0 Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000
and adds errors for -0x.
2008-01-05 00:59:59 +00:00
Martin v. Löwis fcfff0a7fa Bug #1417699: Reject locale-specific decimal point in float()
and atof().
2006-07-03 12:19:50 +00:00
Georg Brandl 80181e2b78 Fix compiler warning. 2006-05-29 14:33:55 +00:00
Georg Brandl b569ee4863 Handle PyMem_Malloc failure in pystrtod.c. Closes #1494671. 2006-05-29 14:28:05 +00:00
Brett Cannon 0ed05875b2 Swap out bare malloc()/free() use for PyMem_MALLOC()/PyMem_FREE() . 2006-05-25 20:44:08 +00:00
Anthony Baxter 64182fe0b3 Some more changes to make code compile under a C++ compiler. 2006-04-11 12:14:09 +00:00
Martin v. Löwis 18e165558b Merge ssize_t branch. 2006-02-15 17:27:45 +00:00
Neal Norwitz d39d861a36 Fix icc warnings: strlen() returns size_t 2006-01-08 01:03:36 +00:00
Neal Norwitz 0e7a0ed335 Fix compiler warnings 2005-12-18 05:37:36 +00:00
Neal Norwitz e7214a130b Get float() to be more portable across platforms. Disable hex strings. 2005-12-18 05:03:17 +00:00
Martin v. Löwis 737ea82a5a Patch #774665: Make Python LC_NUMERIC agnostic. 2004-06-08 18:52:54 +00:00