summaryrefslogtreecommitdiffstats
path: root/Objects/complexobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Issue #8748: Fix incorrect results from comparisons between an integerMark Dickinson2010-05-301-9/+54
| | | | and a complex instance. Based on a patch by Meador Inge.
* Remove declaration for unused variable.Mark Dickinson2010-05-301-1/+0
|
* Issue #5211: Complete removal of implicit coercions for the complexMark Dickinson2010-05-301-19/+2
| | | | | type. Coercion for arithmetic operations was already removed in r78280, but that commit didn't remove coercion for rich comparisons.
* Untabify C files. Will watch buildbots.Antoine Pitrou2010-05-091-971/+971
|
* #7482: clarify error message in case of division by zero of float and ↵Ezio Melotti2010-02-221-2/+2
| | | | complex numbers.
* Issue #5211: Fix complex type to avoid implicit calls toMark Dickinson2010-02-211-26/+45
| | | | complex.__coerce__. Thanks Meador Inge for the patch.
* factor out __complex__ lookup code to fix another caseBenjamin Peterson2010-01-041-50/+44
|
* do correct lookup of the __complex__ methodBenjamin Peterson2010-01-041-8/+14
|
* Include ieeefp.h (when available) in pyport.h instead of individually inMark Dickinson2009-11-281-4/+0
| | | | | | Objects/floatobject.c and Objects/complexobject.c. This should silence compiler warnings about implicit declaration of the 'finite' function on Solaris.
* Issue #7117: Use PyOS_string_to_double instead of PyOS_ascii_strtod inMark Dickinson2009-10-261-16/+29
| | | | | complexobject.c. Also remove length restriction on unicode inputs to the complex constructor.
* Issue #5829: don't raise OverflowError for complex('1e500'). Backport of ↵Mark Dickinson2009-05-201-9/+0
| | | | r72803.
* Issue #6044: remove confusing wording from complex -> integer andMark Dickinson2009-05-171-3/+3
| | | | complex -> float conversion error messages.
* Issue #5920: Changed format.__float__ and complex.__float__ to use a ↵Eric Smith2009-05-051-7/+10
| | | | 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.
* Eliminate some locale-dependent calls to isspace and tolower.Mark Dickinson2009-05-031-4/+4
|
* Issue #1588: Add complex.__format__.Eric Smith2009-04-301-0/+37
|
* Reset errno before both calls to PyOS_ascii_strtod, not just one.Mark Dickinson2009-04-261-2/+2
|
* Fix typo in complex parsing code; expand tests.Mark Dickinson2009-04-251-1/+1
|
* Fix missing 'return NULL'Mark Dickinson2009-04-241-1/+1
|
* Issue #5816:Mark Dickinson2009-04-241-164/+158
| | | | | | | | - 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')
* This reverts r63675 based on the discussion in this thread:Gregory P. Smith2008-06-091-9/+9
| | | | | | | 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.
* Fixed complex.__getnewargs__() to not emit another complex object.Alexandre Vassalotti2008-06-041-1/+2
|
* Renamed PyString to PyBytesChristian Heimes2008-05-261-9/+9
|
* I finally got the time to update and merge Mark's and my trunk-math branch. ↵Christian Heimes2008-04-181-3/+62
| | | | | | The patch is collaborated work of Mark Dickinson and me. It was mostly done a few months ago. The patch fixes a lot of loose ends and edge cases related to operations with NaN, INF, very small values and complex math. The patch also adds acosh, asinh, atanh, log1p and copysign to all platforms. Finally it fixes differences between platforms like different results or exceptions for edge cases. Have fun :)
* Fix compiler warning about finite() missing on Solaris.Neal Norwitz2008-03-281-0/+4
|
* Fixed repr() and str() of complex numbers. Complex suffered from the same ↵Christian Heimes2008-02-151-7/+40
| | | | problem as floats but I forgot to test and fix them.
* static PyObject* variables should use PyString_InternFromString() instead of ↵Christian Heimes2008-01-281-6/+7
| | | | PyObject_FromString() to store a python string in a function level static var.
* Indentation normalization.Georg Brandl2008-01-191-8/+8
|
* Backport PEP 3141 from the py3k branch to the trunk. This includes r50877 (justJeffrey Yasskin2008-01-031-6/+54
| | | | | | | the complex_pow part), r56649, r56652, r56715, r57296, r57302, r57359, r57361, r57372, r57738, r57739, r58017, r58039, r58040, and r59390, and new documentation. The only significant difference is that round(x) returns a float to preserve backward-compatibility. See http://bugs.python.org/issue1689.
* Shut up a compiler warning.Guido van Rossum2007-12-031-0/+1
|
* Patch # 1507 by Mark Dickinson. Make complex(x, -0) retain the sign ofGuido van Rossum2007-11-271-9/+15
| | | | | the imaginary part (as long as it's not complex). Backport candidate?
* Add a bunch of GIL release/acquire points in tp_print implementations and forBrett Cannon2007-09-171-0/+2
| | | | | | PyObject_Print(). Closes issue #1164.
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-2/+1
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Patch #1675423: PyComplex_AsCComplex() now tries to convert an objectGeorg Brandl2007-03-171-1/+48
| | | | | | | to complex using its __complex__() method before falling back to the __float__() method. Therefore, the functions in the cmath module now can operate on objects that define a __complex__() method. (backport)
* Patch #1642844: comments to clarify the complexobject constructor.Georg Brandl2007-03-131-4/+25
|
* Patch #1491866: change the complex() constructor to allow parthensized ↵Collin Winter2007-03-091-5/+25
| | | | forms. This means complex(repr(x)) now works instead of raising a ValueError.
* Fix SF #1676971, Complex OverflowError has a typoNeal Norwitz2007-03-091-1/+1
|
* Use sizeof(buffer) instead of duplicating the constants to ensure they won'tNeal Norwitz2006-07-161-7/+7
| | | | | | | | | be wrong. The real change is to pass (bufsz - 1) to PyOS_ascii_formatd and 1 to strncat. strncat copies n+1 bytes from src (not dest). Reported by Klocwork #58.
* Correctly allocate complex types with tp_alloc. (bug #1498638)Georg Brandl2006-06-011-2/+2
|
* C++ compiler cleanup: bunch-o-casts, plus use of unsigned loop index var in ↵Skip Montanaro2006-04-181-1/+1
| | | | a couple places
* Remove unnecessary casts in type object initializers.Georg Brandl2006-03-301-5/+5
|
* Revert backwards-incompatible const changes.Martin v. Löwis2006-02-271-1/+1
|
* Merge ssize_t branch.Martin v. Löwis2006-02-151-2/+2
|
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-1/+1
| | | | | | | | | | | | | | | | | | | In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
* patch [ 1118729 ] Error in representation of complex numbers(again)Georg Brandl2005-09-161-6/+3
|
* Bug #1079011: Incorrect error message (somewhat)Raymond Hettinger2004-12-191-1/+1
|
* Fix repr for negative imaginary part. Fixes #1013908.Martin v. Löwis2004-08-221-2/+6
|
* Patch #774665: Make Python LC_NUMERIC agnostic.Martin v. Löwis2004-06-081-9/+14
|
* Simplify and speedup uses of Py_BuildValue():Raymond Hettinger2003-10-121-2/+2
| | | | | | * Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c) * Py_BuildValue("()",a) --> PyTuple_New(0) * Py_BuildValue("O", a) --> Py_INCREF(a)
* Remove 'e.g.' from error messageRaymond Hettinger2003-08-301-3/+3
|
* complex_new(): This could leak when the argument was neither string norTim Peters2003-08-151-0/+3
| | | | | | number. This accounts for the 2 refcount leaks per test_complex run Michael Hudson discovered (I figured only I would have the stomach to look for leaks in floating-point code <wink>).