From 0e4636d3b0eeeeb45aec5d339ed16c6d2809d54b Mon Sep 17 00:00:00 2001 From: Mikhail Korobov Date: Wed, 19 Feb 2020 14:08:56 +0500 Subject: [PATCH] Python 3.8 support (CI, setup.py, fix deprecation warning) --- .travis.yml | 2 ++ setup.py | 1 + src/dawg.pyx | 8 ++++++-- tox.ini | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e310602..0efb7d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,8 @@ matrix: env: TOXENV=py36 - python: 3.7 env: TOXENV=py37 + - python: 3.8 + env: TOXENV=py38 install: - pip install -U tox diff --git a/setup.py b/setup.py index 6840940..5dbd134 100755 --- a/setup.py +++ b/setup.py @@ -33,6 +33,7 @@ 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: Implementation :: CPython', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Scientific/Engineering :: Information Analysis', diff --git a/src/dawg.pyx b/src/dawg.pyx index eb20c9f..6dba921 100644 --- a/src/dawg.pyx +++ b/src/dawg.pyx @@ -16,7 +16,11 @@ cimport _guide_builder cimport _dictionary_builder cimport b64_decode -import collections +try: + from collections.abc import Mapping +except ImportError: + # Python 2.7 + from collections import Mapping import struct import sys from binascii import b2a_base64 @@ -852,7 +856,7 @@ def _iterable_from_argument(arg): if arg is None: arg = [] - if isinstance(arg, collections.Mapping): + if isinstance(arg, Mapping): return ((key, arg[key]) for key in arg) else: return arg diff --git a/tox.ini b/tox.ini index 9394545..6f12e09 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py35,py35-locale,py36,py37 +envlist = py27,py35,py35-locale,py36,py37,py38 [testenv] deps =