summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew/3.6.rst
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2016-04-08 19:15:27 (GMT)
committerBrett Cannon <brett@python.org>2016-04-08 19:15:27 (GMT)
commit9e080e0e741dd70cf86500f848eee19cf8b29efa (patch)
tree7d5a4fa6c9279df0c3c3bddd2d041619a6862fa7 /Doc/whatsnew/3.6.rst
parentc5b5ba9bdafaf2542ac2e6939f025a01a10549c2 (diff)
downloadcpython-9e080e0e741dd70cf86500f848eee19cf8b29efa.zip
cpython-9e080e0e741dd70cf86500f848eee19cf8b29efa.tar.gz
cpython-9e080e0e741dd70cf86500f848eee19cf8b29efa.tar.bz2
Issue #25609: Introduce contextlib.AbstractContextManager and
typing.ContextManager.
Diffstat (limited to 'Doc/whatsnew/3.6.rst')
-rw-r--r--Doc/whatsnew/3.6.rst26
1 files changed, 23 insertions, 3 deletions
diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst
index 6799f69..555814e 100644
--- a/Doc/whatsnew/3.6.rst
+++ b/Doc/whatsnew/3.6.rst
@@ -190,6 +190,18 @@ New Modules
Improved Modules
================
+contextlib
+----------
+
+The :class:`contextlib.AbstractContextManager` class has been added to
+provide an abstract base class for context managers. It provides a
+sensible default implementation for `__enter__()` which returns
+`self` and leaves `__exit__()` an abstract method. A matching
+class has been added to the :mod:`typing` module as
+:class:`typing.ContextManager`.
+(Contributed by Brett Cannon in :issue:`25609`.)
+
+
datetime
--------
@@ -246,6 +258,14 @@ telnetlib
Stéphane Wirtel in :issue:`25485`).
+typing
+------
+
+The :class:`typing.ContextManager` class has been added for
+representing :class:`contextlib.AbstractContextManager`.
+(Contributed by Brett Cannon in :issue:`25609`.)
+
+
unittest.mock
-------------
@@ -372,9 +392,9 @@ become proper keywords in Python 3.7.
Deprecated Python modules, functions and methods
------------------------------------------------
-* :meth:`importlib.machinery.SourceFileLoader` and
- :meth:`importlib.machinery.SourcelessFileLoader` are now deprecated. They
- were the only remaining implementations of
+* :meth:`importlib.machinery.SourceFileLoader.load_module` and
+ :meth:`importlib.machinery.SourcelessFileLoader.load_module` are now
+ deprecated. They were the only remaining implementations of
:meth:`importlib.abc.Loader.load_module` in :mod:`importlib` that had not
been deprecated in previous versions of Python in favour of
:meth:`importlib.abc.Loader.exec_module`.