Staging
v0.5.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
Demo
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Python
RISCOS
Tools
.cvsignore -rw-r--r-- 109 bytes
.hgtags -rw-r--r-- 2.2 KB
LICENSE -rw-r--r-- 12.1 KB
Makefile.pre.in -rw-r--r-- 25.9 KB
PLAN.txt -rw-r--r-- 14.1 KB
README -rw-r--r-- 40.1 KB
acconfig.h -rw-r--r-- 7.5 KB
configure -rwxr-xr-x 209.1 KB
configure.in -rw-r--r-- 54.0 KB
install-sh -rwxr-xr-x 5.5 KB
pyconfig.h.in -rw-r--r-- 19.6 KB
setup.py -rw-r--r-- 34.4 KB

README

back to top