[Python-checkins]
python/dist/src/Lib/test test_exceptions.py, 1.19,
1.20 test_warnings.py, 1.4, 1.5
tim_one at users.sourceforge.net
tim_one at users.sourceforge.net
Wed Aug 25 04:14:10 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22424/Lib/test
Modified Files:
test_exceptions.py test_warnings.py
Log Message:
Stop producing or using OverflowWarning. PEP 237 thought this would
happen in 2.3, but nobody noticed it still was getting generated (the
warning was disabled by default). OverflowWarning and
PyExc_OverflowWarning should be removed for 2.5, and left notes all over
saying so.
Index: test_exceptions.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_exceptions.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- test_exceptions.py 10 May 2003 07:36:55 -0000 1.19
+++ test_exceptions.py 25 Aug 2004 02:14:06 -0000 1.20
@@ -85,15 +85,16 @@
r(OverflowError)
# XXX
-# Obscure: this test relies on int+int raising OverflowError if the
-# ints are big enough. But ints no longer do that by default. This
-# test will have to go away someday. For now, we can convert the
-# transitional OverflowWarning into an error.
+# Obscure: in 2.2 and 2.3, this test relied on changing OverflowWarning
+# into an error, in order to trigger OverflowError. In 2.4, OverflowWarning
+# should no longer be generated, so the focus of the test shifts to showing
+# that OverflowError *isn't* generated. OverflowWarning should be gone
+# in Python 2.5, and then the filterwarnings() call, and this comment,
+# should go away.
warnings.filterwarnings("error", "", OverflowWarning, __name__)
x = 1
-try:
- while 1: x = x+x
-except OverflowError: pass
+for dummy in range(128):
+ x += x # this simply shouldn't blow up
r(RuntimeError)
print '(not used any more?)'
Index: test_warnings.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_warnings.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- test_warnings.py 13 Jul 2003 08:37:39 -0000 1.4
+++ test_warnings.py 25 Aug 2004 02:14:06 -0000 1.5
@@ -44,6 +44,7 @@
def test_warn_specific_category(self):
text = 'None'
+ # XXX OverflowWarning should go away for Python 2.5.
for category in [DeprecationWarning, FutureWarning, OverflowWarning,
PendingDeprecationWarning, RuntimeWarning,
SyntaxWarning, UserWarning, Warning]:
More information about the Python-checkins
mailing list