ipapy icon indicating copy to clipboard operation
ipapy copied to clipboard

Collections import compatibility fix for Python versions 3.8+

Open ionite34 opened this issue 3 years ago • 0 comments

In Python 3.7, importing ABCs directly from the collections module shows a warning and the import is deprecated since Python 3.8+

See: https://github.com/python/cpython/commit/c66f9f8d3909f588c251957d499599a1680e2320

Pull request added different compatible import methods per Python version.

Changes for ipapy/ipastring.py

-from collections import MutableSequence
import sys
if sys.version_info[:2] >= (3, 8):
    from collections.abc import MutableSequence
else:
    from collections import MutableSequence

Changes for ipapy/mapper.py

-from collections import MutableMapping
import sys
if sys.version_info[:2] >= (3, 8):
    from collections.abc import MutableMapping
else:
    from collections import MutableMapping

ionite34 avatar May 04 '22 18:05 ionite34