Staging
v0.8.1
https://github.com/python/cpython
Revision e99c99389c582b08a648d7f17823b2cce74e8842 authored by Michael W. Hudson on 25 March 2002, 13:21:41 UTC, committed by Michael W. Hudson on 25 March 2002, 13:21:41 UTC
    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.
1 parent 777f143
History
Tip revision: e99c99389c582b08a648d7f17823b2cce74e8842 authored by Michael W. Hudson on 25 March 2002, 13:21:41 UTC
backport tim_one's checkin of
Tip revision: e99c993
File Mode Size
.cvsignore -rw-r--r-- 17 bytes
abstract.c -rw-r--r-- 41.7 KB
bufferobject.c -rw-r--r-- 11.2 KB
cellobject.c -rw-r--r-- 2.3 KB
classobject.c -rw-r--r-- 55.2 KB
cobject.c -rw-r--r-- 3.6 KB
complexobject.c -rw-r--r-- 21.9 KB
descrobject.c -rw-r--r-- 26.0 KB
dictobject.c -rw-r--r-- 49.8 KB
fileobject.c -rw-r--r-- 41.4 KB
floatobject.c -rw-r--r-- 21.7 KB
frameobject.c -rw-r--r-- 11.9 KB
funcobject.c -rw-r--r-- 16.0 KB
intobject.c -rw-r--r-- 24.1 KB
iterobject.c -rw-r--r-- 5.8 KB
listobject.c -rw-r--r-- 44.5 KB
longobject.c -rw-r--r-- 52.5 KB
methodobject.c -rw-r--r-- 7.1 KB
moduleobject.c -rw-r--r-- 5.6 KB
object.c -rw-r--r-- 47.0 KB
obmalloc.c -rw-r--r-- 22.2 KB
rangeobject.c -rw-r--r-- 7.0 KB
sliceobject.c -rw-r--r-- 4.7 KB
stringobject.c -rw-r--r-- 86.1 KB
structseq.c -rw-r--r-- 8.6 KB
tupleobject.c -rw-r--r-- 14.6 KB
typeobject.c -rw-r--r-- 103.8 KB
unicodectype.c -rw-r--r-- 8.6 KB
unicodeobject.c -rw-r--r-- 140.2 KB
unicodetype_db.h -rw-r--r-- 37.0 KB
weakrefobject.c -rw-r--r-- 21.0 KB
xxobject.c -rw-r--r-- 2.4 KB

back to top