Mark Dickinson
d20fb82195
Issue #16290 : __complex__ must now always return an instance of complex.
13 years ago
Victor Stinner
d3f0882dfb
Issue #14744 : Use the new _PyUnicodeWriter internal API to speed up str%args and str.format(args)
* Formatting string, int, float and complex use the _PyUnicodeWriter API. It
avoids a temporary buffer in most cases.
* Add _PyUnicodeWriter_WriteStr() to restore the PyAccu optimization: just
keep a reference to the string if the output is only composed of one string
* Disable overallocation when formatting the last argument of str%args and
str.format(args)
* Overallocation allocates at least 100 characters: add min_length attribute
to the _PyUnicodeWriter structure
* Add new private functions: _PyUnicode_FastCopyCharacters(),
_PyUnicode_FastFill() and _PyUnicode_FromASCII()
The speed up is around 20% in average.
14 years ago
Benjamin Peterson
ce79852077
use the static identifier api for looking up special methods
I had to move the static identifier code from unicodeobject.h to object.h in
order for this to work.
14 years ago
Martin v. Löwis
d63a3b8beb
Implement PEP 393.
15 years ago
Brian Curtin
dfc80e3d97
Replace Py_NotImplemented returns with the macro form Py_RETURN_NOTIMPLEMENTED.
The macro was introduced in #12724 .
15 years ago
Jesus Cea
2fc8b87499
Port 5b607cd8c71b ( closes #11892 )
15 years ago
Victor Stinner
6ced7c4333
Issue #10833 : Use PyErr_Format() and PyUnicode_FromFormat() instead of
PyOS_snprintf() to avoid temporary buffer allocated on the stack and a
conversion from bytes to Unicode.
15 years ago
Eric Smith
70099a1555
Removed static function complex_format, moved it into complex_repr. Modified tests to check both str and repr, which are the same for complex.
15 years ago
Alexander Belopolsky
942af5a9a4
Issue #10557 : Fixed error messages from float() and other numeric
types. Added a new API function, PyUnicode_TransformDecimalToASCII(),
which transforms non-ASCII decimal digits in a Unicode string to their
ASCII equivalents.
15 years ago
Victor Stinner
f961377e99
#6780 : fix complex() constructor TypeError message
15 years ago
Benjamin Peterson
8035bc5c04
follow up to #9778 : define and use an unsigned hash type
15 years ago
Benjamin Peterson
8f67d0893f
make hashes always the size of pointers; introduce Py_hash_t #9778
15 years ago
Mark Dickinson
388122d43b
Issue #9337 : Make float.__str__ identical to float.__repr__.
(And similarly for complex numbers.)
16 years ago
Mark Dickinson
4ca7c3c089
Issue #8748 : Fix incorrect results from comparisons between an integer
and a complex instance. Based on a patch by Meador Inge.
16 years ago
Mark Dickinson
4b3035d0b8
Remove declaration for unused variable.
16 years ago
Mark Dickinson
813363743d
Issue #5211 : Complete removal of implicit coercions for the complex
type. Coercion for arithmetic operations was already removed in
r78280, but that commit didn't remove coercion for rich comparisons.
16 years ago
Mark Dickinson
dc787d2055
Issue #8188 : Introduce a new scheme for computing hashes of numbers
(instances of int, float, complex, decimal.Decimal and
fractions.Fraction) that makes it easy to maintain the invariant that
hash(x) == hash(y) whenever x and y have equal value.
16 years ago
Mark Dickinson
cc6a982de8
Issue #8748 : Fix two issues with comparisons between complex and integer
objects. (1) The comparison could incorrectly return True in some cases
(2**53+1 == complex(2**53) == 2**53), breaking transivity of equality.
(2) The comparison raised an OverflowError for large integers, leading
to unpredictable exceptions when combining integers and complex objects
in sets or dicts.
Patch by Meador Inge.
16 years ago
Antoine Pitrou
7f14f0d8a0
Recorded merge of revisions 81032 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines
Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines
Untabify C files. Will watch buildbots.
........
................
16 years ago
Antoine Pitrou
f95a1b3c53
Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines
Untabify C files. Will watch buildbots.
........
16 years ago
Antoine Pitrou
c7c96a90bc
Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines
Untabify C files. Will watch buildbots.
........
16 years ago
Antoine Pitrou
c83ea137d7
Untabify C files. Will watch buildbots.
16 years ago
Mark Dickinson
f673f0c40c
Issue #7845 : Make 1j.__le__(2j) return NotImplemented rather than raising TypeError.
16 years ago
Ezio Melotti
50363262b2
Merged revisions 78319 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78319 | ezio.melotti | 2010-02-22 18:30:58 +0200 (Mon, 22 Feb 2010) | 1 line
#7482 : clarify error message in case of division by zero of float and complex numbers.
........
16 years ago
Ezio Melotti
bce3e17bd2
#7482 : clarify error message in case of division by zero of float and complex numbers.
16 years ago
Mark Dickinson
82b34c5dbe
Issue #5211 : Fix complex type to avoid implicit calls to
complex.__coerce__. Thanks Meador Inge for the patch.
16 years ago
Benjamin Peterson
aea4428fdc
Merged revisions 77292-77293 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77292 | benjamin.peterson | 2010-01-03 18:43:01 -0600 (Sun, 03 Jan 2010) | 1 line
do correct lookup of the __complex__ method
........
r77293 | benjamin.peterson | 2010-01-03 19:00:47 -0600 (Sun, 03 Jan 2010) | 1 line
factor out __complex__ lookup code to fix another case
........
16 years ago
Benjamin Peterson
3694366af5
factor out __complex__ lookup code to fix another case
16 years ago
Benjamin Peterson
ecdae19fbe
do correct lookup of the __complex__ method
16 years ago
Mark Dickinson
a4962cb694
Merged revisions 76561 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76561 | mark.dickinson | 2009-11-28 12:30:36 +0000 (Sat, 28 Nov 2009) | 5 lines
Include ieeefp.h (when available) in pyport.h instead of individually in
Objects/floatobject.c and Objects/complexobject.c. This should silence
compiler warnings about implicit declaration of the 'finite' function
on Solaris.
........
16 years ago
Mark Dickinson
31f0cfef0e
Include ieeefp.h (when available) in pyport.h instead of individually in
Objects/floatobject.c and Objects/complexobject.c. This should silence
compiler warnings about implicit declaration of the 'finite' function
on Solaris.
16 years ago
Mark Dickinson
c04c7c5b72
Issue #7117 : Use PyOS_string_to_double instead of PyOS_ascii_strtod in
complexobject.c. Also remove length restriction on unicode inputs to
the complex constructor.
16 years ago
Mark Dickinson
1daebdf82c
Make sure memory is freed on error in complex_subtype_from_string.
16 years ago
Mark Dickinson
f972488213
Remove length limitation on string arguments to complex()
16 years ago
Skip Montanaro
ba1e0f46ab
Issue 7147 - remove ability to attempt to build Python without complex number support (was broken anyway)
16 years ago
Mark Dickinson
a4e0efa4b1
Issue #5829 : don't raise OverflowError for complex('1e500'). Backport of r72803.
17 years ago
Mark Dickinson
6b1e43b7bc
Issue #5829 : complex('1e500') shouldn't raise OverflowError
17 years ago
Mark Dickinson
df99f04895
Merged revisions 72718 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72718 | mark.dickinson | 2009-05-17 11:38:30 +0100 (Sun, 17 May 2009) | 4 lines
Issue #6044 : remove confusing wording from complex -> integer and
complex -> float conversion error messages.
........
17 years ago
Mark Dickinson
578cc749ab
Merged revisions 72718 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72718 | mark.dickinson | 2009-05-17 11:38:30 +0100 (Sun, 17 May 2009) | 4 lines
Issue #6044 : remove confusing wording from complex -> integer and
complex -> float conversion error messages.
........
17 years ago
Mark Dickinson
50626db437
Issue #6044 : remove confusing wording from complex -> integer and
complex -> float conversion error messages.
17 years ago
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.
17 years ago
Eric Smith
63376228a3
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.
17 years ago
Mark Dickinson
aa77d26009
Merged revisions 72253 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72253 | mark.dickinson | 2009-05-03 21:59:48 +0100 (Sun, 03 May 2009) | 2 lines
Eliminate some locale-dependent calls to isspace and tolower.
........
17 years ago
Mark Dickinson
777e4ff503
Eliminate some locale-dependent calls to isspace and tolower.
17 years ago
Mark Dickinson
725bfd8489
Issue #5914 : Add new C-API function PyOS_string_to_double, to complement
PyOS_double_to_string, and deprecate PyOS_ascii_strtod and PyOS_ascii_atof.
17 years ago
Eric Smith
58a42244cf
Issue #1588 : Add complex.__format__.
17 years ago
Eric Smith
9139cc6a3b
Issue #1588 : Add complex.__format__.
17 years ago
Mark Dickinson
35f1c9470a
Merged revisions 71963 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r71963 | mark.dickinson | 2009-04-26 15:00:08 +0100 (Sun, 26 Apr 2009) | 2 lines
Reset errno before both calls to PyOS_ascii_strtod, not just one.
........
17 years ago
Mark Dickinson
944c6aedd0
Reset errno before both calls to PyOS_ascii_strtod, not just one.
17 years ago
Mark Dickinson
22999a69e1
Issue #5829 : complex('1e-500') shouldn't raise an exception.
Also fix some confusing indentation.
17 years ago