Closed
Description
On Python 3.10.0a3:
Python 3.10.0a3 (default, Dec 8 2020, 03:28:14)
>>> import tabulate
/tmp/tabulate-venv/lib/python3.10/site-packages/tabulate.py:16: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
from collections import Iterable
>>>
This was "fixed" in 3bfe294, and indeed there's no warning on 3.8.5:
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
>>> import tabulate
>>>
The relevant code is
Lines 13 to 16 in 2552e6d
However, the fix is not tolerant to Python 3.10's extra digit -- python_version_tuple()
returns ('3', '10', '0a3')
, and since these are strings '10'
is treated as being less than '3'
. The recommended way to perform this is:
if sys.version_info >= (3, 3):
from collections.abc import Iterable
else:
from collections import Iterable
since sys.version_info
is a tuple of ints, and correctly handles two-digit minor versions.
Happy to submit a PR to fix this, assuming you still want to support Python versions that old?
Metadata
Metadata
Assignees
Labels
No labels