mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 10:26:19 +03:00
Merge pull request #3123 from hugovk/collections.abc-deprecationwarning
Fix collections ABCs DeprecationWarning in Python 3.7
This commit is contained in:
commit
9e5494e9a6
|
@ -121,8 +121,14 @@ import struct
|
|||
import atexit
|
||||
|
||||
# type stuff
|
||||
import collections
|
||||
import numbers
|
||||
try:
|
||||
# Python 3
|
||||
from collections.abc import Callable
|
||||
except ImportError:
|
||||
# Python 2.7
|
||||
from collections import Callable
|
||||
|
||||
|
||||
# works everywhere, win for pypy, not cpython
|
||||
USE_CFFI_ACCESS = hasattr(sys, 'pypy_version_info')
|
||||
|
@ -1145,7 +1151,7 @@ class Image(object):
|
|||
|
||||
self.load()
|
||||
|
||||
if isinstance(filter, collections.Callable):
|
||||
if isinstance(filter, Callable):
|
||||
filter = filter()
|
||||
if not hasattr(filter, "filter"):
|
||||
raise TypeError("filter argument should be ImageFilter.Filter " +
|
||||
|
|
|
@ -58,6 +58,13 @@ import warnings
|
|||
|
||||
from .TiffTags import TYPES
|
||||
|
||||
try:
|
||||
# Python 3
|
||||
from collections.abc import MutableMapping
|
||||
except ImportError:
|
||||
# Python 2.7
|
||||
from collections import MutableMapping
|
||||
|
||||
|
||||
__version__ = "1.3.5"
|
||||
DEBUG = False # Needs to be merged with the new logging approach.
|
||||
|
@ -398,7 +405,7 @@ class IFDRational(Rational):
|
|||
__round__ = _delegate('__round__')
|
||||
|
||||
|
||||
class ImageFileDirectory_v2(collections.MutableMapping):
|
||||
class ImageFileDirectory_v2(MutableMapping):
|
||||
"""This class represents a TIFF tag directory. To speed things up, we
|
||||
don't decode tags unless they're asked for.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user