Skip to content

Commit c47c78b

Browse files
authored
bpo-37324: Remove ABC aliases from collections (GH-23754)
Remove deprecated aliases to Abstract Base Classes from the collections module.
1 parent 6dfd173 commit c47c78b

File tree

4 files changed

+6
-21
lines changed

4 files changed

+6
-21
lines changed

Doc/library/collections.rst

-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ Python's general purpose built-in containers, :class:`dict`, :class:`list`,
3333
:class:`UserString` wrapper around string objects for easier string subclassing
3434
===================== ====================================================================
3535

36-
.. deprecated-removed:: 3.3 3.10
37-
Moved :ref:`collections-abstract-base-classes` to the :mod:`collections.abc` module.
38-
For backwards compatibility, they continue to be visible in this module through
39-
Python 3.9.
40-
4136

4237
:class:`ChainMap` objects
4338
-------------------------

Doc/whatsnew/3.10.rst

+4
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,10 @@ Removed
550550
now due to the _warnings module was converted to a builtin module in 2.6.
551551
(Contributed by Hai Shi in :issue:`42599`.)
552552

553+
* Remove deprecated aliases to :ref:`collections-abstract-base-classes` from
554+
the :mod:`collections` module.
555+
(Contributed by Victor Stinner in :issue:`37324`.)
556+
553557

554558
Porting to Python 3.10
555559
======================

Lib/collections/__init__.py

-16
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,6 @@
5151
pass
5252

5353

54-
def __getattr__(name):
55-
# For backwards compatibility, continue to make the collections ABCs
56-
# through Python 3.6 available through the collections module.
57-
# Note, no new collections ABCs were added in Python 3.7
58-
if name in _collections_abc.__all__:
59-
obj = getattr(_collections_abc, name)
60-
import warnings
61-
warnings.warn("Using or importing the ABCs from 'collections' instead "
62-
"of from 'collections.abc' is deprecated since Python 3.3, "
63-
"and in 3.10 it will stop working",
64-
DeprecationWarning, stacklevel=2)
65-
globals()[name] = obj
66-
return obj
67-
raise AttributeError(f'module {__name__!r} has no attribute {name!r}')
68-
69-
7054
################################################################################
7155
### OrderedDict
7256
################################################################################
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove deprecated aliases to :ref:`collections-abstract-base-classes` from
2+
the :mod:`collections` module.

0 commit comments

Comments
 (0)