-
-
Notifications
You must be signed in to change notification settings - Fork 659
Description
Background (read
Python 3 documentation for the collections
module
for more detail):
-
Collections Abstract Base Classes
("CABCs") moved to thecollections.abc
module in Python 3.3. -
These "Collections Abstract Base Classes" are:
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
. -
For backwards compatibility, CABCs continue to be visible
in thecollections
module through Python 3.8; and can be
imported either fromcollections
or fromcollections.abc
. -
Starting with Python 3.9, CABCs must be imported from
collections.abc
. -
In Python 2 they could only be imported from 'collections',
not from 'collections.abc'. So while Sage was keeping
Py2 and Py3 compatible it made sense to import fromcollections
. -
In Python 3.7 and Python 3.8, importing them from
collections
gives a deprecation warning. This warning was silenced in Sage,
see py3: last test in tests/cmdline.py #28002.
In this ticket we import the classes from collections.abc
.
We do not suppress the silencing of the deprecation warning yet.
See comment:23 and #30768.
CC: @fchapoton @jhpalmieri @slel @videlec @tscrim
Component: python3
Keywords: days101, collections.abc
Author: Samuel Lelièvre
Branch: 4f80136
Reviewer: John Palmieri
Issue created by migration from https://trac.sagemath.org/ticket/28012