Commit Graph

3103 Commits

Author SHA1 Message Date
Mark Dickinson
0a6501bf56 Fix typo in complex parsing code; expand tests. 2009-04-25 09:47:00 +00:00
Benjamin Peterson
5083dc552b fix a segfault when setting __class__ in __del__ #5283 2009-04-25 00:41:22 +00:00
Mark Dickinson
90d47cb46c Fix missing 'return NULL' 2009-04-24 13:14:07 +00:00
Mark Dickinson
95bc980d9e Issue #5816:
- simplify parsing and printing of complex numbers
 - make complex(repr(z)) round-tripping work for complex
   numbers involving nans, infs, or negative zeros
 - don't accept some of the stranger complex strings
   that were previously allowed---e.g., complex('1..1j')
2009-04-24 12:46:53 +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
Mark Dickinson
6736cf8d20 Issue #3166: Make long -> float (and int -> float) conversions
correctly rounded, using round-half-to-even.  This ensures that the
value of float(n) doesn't depend on whether we're using 15-bit digits
or 30-bit digits for Python longs.
2009-04-20 21:13:33 +00:00
Benjamin Peterson
8cfa8e613f make errors consistent 2009-04-19 02:40:43 +00:00
Benjamin Peterson
308c6ba002 initialize weakref some weakref types 2009-04-19 02:32:42 +00:00
Benjamin Peterson
01c6e6fb35 many more types to initialize (I had to expose some of them) 2009-04-18 22:15:26 +00:00
Benjamin Peterson
5ce73759bf initalize -> initialize 2009-04-18 20:25:25 +00:00
Benjamin Peterson
d4d400cb8a try to initalize all builtin types with PyType_Ready to avoid problems like #5787 2009-04-18 20:12:47 +00:00
Benjamin Peterson
d672001b03 rename internal bytes_ functions to bytearray 2009-04-18 15:31:34 +00:00
Georg Brandl
f5fd523981 "not subscriptable" should be a bit more understandable than "unsubscriptable". 2009-04-18 08:26:21 +00:00
Benjamin Peterson
99d36f1563 call __float__ on str subclasses #5759
tests by R. David Murray
2009-04-15 21:26:36 +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
Georg Brandl
517cfdcfd9 Whitespace normalization. 2009-04-05 13:16:35 +00:00
Georg Brandl
d3eaa745a9 #5615: make it possible to configure --without-threads again. 2009-04-05 11:07:14 +00:00
Antoine Pitrou
789be0c0a0 Issue #2396: backport the memoryview object. 2009-04-02 21:18:34 +00:00
Mark Dickinson
48e3fd240f sys.long_info attributes should be ints, not longs 2009-04-02 18:39:37 +00:00
Georg Brandl
42827e91ee Fix a wrong struct field assignment (docstring as closure). 2009-03-31 01:25:15 +00:00
Mark Dickinson
d4814bfa23 Issue #532631: Apply floatformat changes to unicodeobject.c
as well as stringobject.c.
2009-03-29 16:24:29 +00:00
Mark Dickinson
174e909842 Issue #532631: Add paranoid check to avoid potential buffer overflow
on systems with sizeof(int) > 4.
2009-03-29 16:17:16 +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
Antoine Pitrou
1fba62427c The tracking statistics were actually too pessimistic 2009-03-23 19:17:00 +00:00