Skip to content

Commit 95262b1

Browse files
bpo-25988: Do not expose abstract collection classes in the collections module.
1 parent b727239 commit 95262b1

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

Doc/whatsnew/3.8.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,11 @@ The following features and APIs have been removed from Python 3.8:
557557
* Removed the ``doctype()`` method of :class:`~xml.etree.ElementTree.XMLParser`.
558558
(Contributed by Serhiy Storchaka in :issue:`29209`.)
559559

560+
* The abstract base classes in :mod:`collections.abc` no longer are
561+
exposed in the regular :mod:`collections` module. This will help
562+
create a clearer distinction between the concrete classes and the abstract
563+
base classes.
564+
560565

561566
Porting to Python 3.8
562567
=====================

Lib/collections/__init__.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,6 @@
3939
pass
4040

4141

42-
def __getattr__(name):
43-
# For backwards compatibility, continue to make the collections ABCs
44-
# through Python 3.6 available through the collections module.
45-
# Note, no new collections ABCs were added in Python 3.7
46-
if name in _collections_abc.__all__:
47-
obj = getattr(_collections_abc, name)
48-
import warnings
49-
warnings.warn("Using or importing the ABCs from 'collections' instead "
50-
"of from 'collections.abc' is deprecated, "
51-
"and in 3.8 it will stop working",
52-
DeprecationWarning, stacklevel=2)
53-
globals()[name] = obj
54-
return obj
55-
raise AttributeError(f'module {__name__!r} has no attribute {name!r}')
56-
5742
################################################################################
5843
### OrderedDict
5944
################################################################################
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The abstract base classes in :mod:`collections.abc` no longer are exposed in
2+
the regular :mod:`collections` module.

0 commit comments

Comments
 (0)