summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
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)