summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-03-04 04:47:04 (GMT)
committerRaymond Hettinger <python@rcn.com>2005-03-04 04:47:04 (GMT)
commitace3f61994a7ea5e9284d4297a5a90307be23179 (patch)
treee6e7884121ce74c8d39be6b11c36939126b93765 /Lib
parentf05d1c0099fa3f5a46b0d9b0eb709db3bbb6cf2f (diff)
downloadcpython-ace3f61994a7ea5e9284d4297a5a90307be23179.zip
cpython-ace3f61994a7ea5e9284d4297a5a90307be23179.tar.gz
cpython-ace3f61994a7ea5e9284d4297a5a90307be23179.tar.bz2
Convert "__init__ should return None" from an exception to a warning.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_descr.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 26df0f2..4af59b0 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -3965,17 +3965,23 @@ def vicious_descriptor_nonsense():
import gc; gc.collect()
vereq(hasattr(c, 'attr'), False)
+import warnings
+
def test_init():
# SF 1155938
class Foo(object):
def __init__(self):
return 10
+
+ oldfilters = warnings.filters
+ warnings.filterwarnings("error", category=RuntimeWarning)
try:
Foo()
- except TypeError:
+ except RuntimeWarning:
pass
else:
raise TestFailed, "did not test __init__() for None return"
+ warnings.filters = oldfilters
def test_main():