]> granicus.if.org Git - python/commitdiff
bpo-25988: Deprecate exposing collections.abc in collections GH-5414
authorRaymond Hettinger <rhettinger@users.noreply.github.com>
Mon, 29 Jan 2018 16:27:49 +0000 (08:27 -0800)
committerGitHub <noreply@github.com>
Mon, 29 Jan 2018 16:27:49 +0000 (08:27 -0800)
Doc/library/collections.rst
Doc/whatsnew/3.7.rst
Lib/collections/__init__.py
Misc/NEWS.d/next/Library/2018-01-28-23-48-45.bpo-25988.I9uBct.rst [new file with mode: 0644]

index 18aaba65b252c379d3ce2ed36ee3e65dab0a557f..772ff60fe9839acdbdd90c5ca6e7b554a58ee87e 100644 (file)
@@ -35,8 +35,8 @@ Python's general purpose built-in containers, :class:`dict`, :class:`list`,
 
 .. versionchanged:: 3.3
     Moved :ref:`collections-abstract-base-classes` to the :mod:`collections.abc` module.
-    For backwards compatibility, they continue to be visible in this module
-    as well.
+    For backwards compatibility, they continue to be visible in this module through
+    Python 3.7.  Subsequently, they will be removed entirely.
 
 
 :class:`ChainMap` objects
index e36e505fd8ae5b1c67fb06a26cc6df2f22e7ab65..71070df764704126344e400af5f03d32cb608326 100644 (file)
@@ -880,6 +880,11 @@ Other CPython Implementation Changes
 Deprecated
 ==========
 
+* In Python 3.8, the abstract base classes in :mod:`collections.abc` will no
+  longer be exposed in the regular :mod:`collections` module.  This will help
+  create a clearer distinction between the concrete classes and the abstract
+  base classes.
+
 * Yield expressions (both ``yield`` and ``yield from`` clauses) are now deprecated
   in comprehensions and generator expressions (aside from the iterable expression
   in the leftmost :keyword:`for` clause). This ensures that comprehensions
index 21d91fd61d607c6d8606a8729dd936d046a5e9fb..8aeee359cd623e1d9b54a42ba1ab7c5632195708 100644 (file)
@@ -18,10 +18,14 @@ __all__ = ['deque', 'defaultdict', 'namedtuple', 'UserDict', 'UserList',
             'UserString', 'Counter', 'OrderedDict', 'ChainMap']
 
 # For backwards compatibility, continue to make the collections ABCs
-# available through the collections module.
-from _collections_abc import *
+# through Python 3.6 available through the collections module.
+# Note, no new collections ABCs were added in Python 3.7
 import _collections_abc
-__all__ += _collections_abc.__all__
+from _collections_abc import (AsyncGenerator, AsyncIterable, AsyncIterator,
+    Awaitable, ByteString, Callable, Collection, Container, Coroutine,
+    Generator, Hashable, ItemsView, Iterable, Iterator, KeysView, Mapping,
+    MappingView, MutableMapping, MutableSequence, MutableSet, Reversible,
+    Sequence, Set, Sized, ValuesView)
 
 from operator import itemgetter as _itemgetter, eq as _eq
 from keyword import iskeyword as _iskeyword
diff --git a/Misc/NEWS.d/next/Library/2018-01-28-23-48-45.bpo-25988.I9uBct.rst b/Misc/NEWS.d/next/Library/2018-01-28-23-48-45.bpo-25988.I9uBct.rst
new file mode 100644 (file)
index 0000000..df35077
--- /dev/null
@@ -0,0 +1,2 @@
+Deprecate exposing the contents of collections.abc in the regular
+collections module.