Files
cpython/Objects
Michael W. Hudson e99c99389c backport tim_one's checkin of
revision 2.55 of complexobject.c

SF bug 533198:  Complex power underflow raises exception.
Konrad was too kind.  Not only did it raise an exception, the specific
exception it raised made no sense.  These are old bugs in complex_pow()
and friends:

1. Raising 0 to a negative power isn't a range error, it's a domain
   error, so changed c_pow() to set errno to EDOM in that case instead
   of ERANGE.

2. Changed complex_pow() to:

A. Used the Py_ADJUST_ERANGE2 macro to try to clear errno of a spurious
   ERANGE error due to underflow in the libm pow() called by c_pow().

B. Produced different exceptions depending on the errno value:
   i) For errno==EDOM, raise ZeroDivisionError instead of ValueError.
      This is for consistency with the non-complex cases 0.0**-2 and
      0**-2 and 0L**-2.
   ii) For errno==ERANGE, raise OverflowError.

Bugfix candidate.
2002-03-25 13:21:41 +00:00
..
2000-05-02 18:34:30 +00:00
2001-10-19 13:49:35 +00:00
2001-08-29 23:54:21 +00:00
2002-03-25 13:21:41 +00:00
2002-03-11 10:17:17 +00:00
2002-03-05 15:42:48 +00:00
2002-03-05 15:41:40 +00:00
2002-03-07 15:16:07 +00:00
2002-03-18 12:47:52 +00:00