Deprecate contextlib.nested(). The with-statement now provides this functionality directly.
diff --git a/Lib/contextlib.py b/Lib/contextlib.py
index c9793af..af701d3 100644
--- a/Lib/contextlib.py
+++ b/Lib/contextlib.py
@@ -2,6 +2,7 @@
import sys
from functools import wraps
+from warnings import warn
__all__ = ["contextmanager", "nested", "closing"]
@@ -101,6 +102,8 @@
<body>
"""
+ warn("With-statements now directly support multiple context managers",
+ DeprecationWarning, 2)
exits = []
vars = []
exc = (None, None, None)
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py
index 4d029dc..274af3d 100644
--- a/Lib/test/test_contextlib.py
+++ b/Lib/test/test_contextlib.py
@@ -9,6 +9,7 @@
import threading
from contextlib import * # Tests __all__
from test import test_support
+import warnings
class ContextManagerTestCase(unittest.TestCase):
@@ -331,7 +332,9 @@
# This is needed to make the test actually run under regrtest.py!
def test_main():
- test_support.run_unittest(__name__)
+ with warnings.catch_warnings():
+ warnings.simplefilter('ignore')
+ test_support.run_unittest(__name__)
if __name__ == "__main__":
test_main()