[Python-checkins] CVS: python/dist/src/Lib/test test_math.py,1.12,1.13

Tim Peters tim_one@users.sourceforge.net
Wed, 05 Sep 2001 15:36:58 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv29981/python/Lib/test

Modified Files:
	test_math.py 
Log Message:
Rework the way we try to check for libm overflow, given that C99 no longer
requires that errno ever get set, and it looks like glibc is already
playing that game.  New rules:

+ Never use HUGE_VAL.  Use the new Py_HUGE_VAL instead.

+ Never believe errno.  If overflow is the only thing you're interested in,
  use the new Py_OVERFLOWED(x) macro.  If you're interested in any libm
  errors, use the new Py_SET_ERANGE_IF_OVERFLOW(x) macro, which attempts
  to set errno the way C89 said it worked.

Unfortunately, none of these are reliable, but they work on Windows and I
*expect* under glibc too.


Index: test_math.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_math.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** test_math.py	2001/04/12 00:24:41	1.12
--- test_math.py	2001/09/05 22:36:56	1.13
***************
*** 182,186 ****
  
      # If this fails, it could be a puzzle.  One odd possibility is that
!     # mathmodule.c's CHECK() macro is getting confused while comparing
      # Inf (HUGE_VAL) to a NaN, and artificially setting errno to ERANGE
      # as a result (and so raising OverflowError instead).
--- 182,186 ----
  
      # If this fails, it could be a puzzle.  One odd possibility is that
!     # mathmodule.c's macros are getting confused while comparing
      # Inf (HUGE_VAL) to a NaN, and artificially setting errno to ERANGE
      # as a result (and so raising OverflowError instead).