summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-08-25 02:14:08 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-08-25 02:14:08 (GMT)
commitc8854434790d3a281f0ea5a4714e5c01414413b0 (patch)
treef6edfa8738087c52d1fb4e077bba738f2f42cd49 /Lib
parent1fa040ba73db700debd9f5079fa2083a0937f8b6 (diff)
downloadcpython-c8854434790d3a281f0ea5a4714e5c01414413b0.zip
cpython-c8854434790d3a281f0ea5a4714e5c01414413b0.tar.gz
cpython-c8854434790d3a281f0ea5a4714e5c01414413b0.tar.bz2
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.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_exceptions.py15
-rw-r--r--Lib/test/test_warnings.py1
-rw-r--r--Lib/warnings.py1
3 files changed, 10 insertions, 7 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 83e680f..c157122 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -85,15 +85,16 @@ except NameError: pass
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?)'
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py
index 4bfae32..c861a2e 100644
--- a/Lib/test/test_warnings.py
+++ b/Lib/test/test_warnings.py
@@ -44,6 +44,7 @@ class TestModule(unittest.TestCase):
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]:
diff --git a/Lib/warnings.py b/Lib/warnings.py
index 849cced..fd944ed 100644
--- a/Lib/warnings.py
+++ b/Lib/warnings.py
@@ -250,5 +250,6 @@ def _getcategory(category):
# Module initialization
_processoptions(sys.warnoptions)
+# XXX OverflowWarning should go away for Python 2.5.
simplefilter("ignore", category=OverflowWarning, append=1)
simplefilter("ignore", category=PendingDeprecationWarning, append=1)