Skip to content

Commit ec3ce7a

Browse files
committed
Add conditional import of MutableMapping
Importing the abstract base classes directly from the collections module is deprecated in Python 3.7. They have been moved to collections.abc and the deprecated way will stop working in Python 3.8. See: https://docs.python.org/3/library/collections.html
1 parent 45d649e commit ec3ce7a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

symengine/lib/symengine_wrapper.pyx

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ import collections
1919
import warnings
2020
from symengine.compatibility import is_sequence
2121
import os
22+
import sys
23+
24+
if sys.version_info[0] == 2:
25+
from collections import MutableMapping
26+
else:
27+
from collections.abc import MutableMapping
2228

2329
try:
2430
import numpy as np
@@ -720,7 +726,7 @@ cdef class _DictBasic(object):
720726
return d
721727

722728

723-
class DictBasic(_DictBasic, collections.MutableMapping):
729+
class DictBasic(_DictBasic, MutableMapping):
724730

725731
def __str__(self):
726732
return "{" + ", ".join(["%s: %s" % (str(key), str(value)) for key, value in self.items()]) + "}"

0 commit comments

Comments
 (0)