diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-03-14 19:07:59 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-14 19:07:59 -0600 |
commit | 020f2ad4e133b7500c7062d89368d38f19e836fd (patch) | |
tree | 37054f48b52d3725f7b1f6a840fd0f0d40ba2399 /numpy/core/numeric.py | |
parent | a91f61a429e35a47f6faa025ceb862664dc12609 (diff) | |
parent | 53b358ce7eddf78ac2bc22045fbe25e91e663b9a (diff) | |
download | numpy-020f2ad4e133b7500c7062d89368d38f19e836fd.tar.gz |
Merge pull request #10743 from fred-lefebvre/master
MAINT: Import abstract classes from collections.abc
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r-- | numpy/core/numeric.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 1f249ae6c..d2348f364 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1,6 +1,11 @@ from __future__ import division, absolute_import, print_function -import collections +try: + # Accessing collections abstact classes from collections + # has been deprecated since Python 3.3 + import collections.abc as collections_abc +except ImportError: + import collections as collections_abc import itertools import operator import sys @@ -2758,8 +2763,8 @@ def seterrcall(func): {'over': 'log', 'divide': 'log', 'invalid': 'log', 'under': 'log'} """ - if func is not None and not isinstance(func, collections.Callable): - if not hasattr(func, 'write') or not isinstance(func.write, collections.Callable): + if func is not None and not isinstance(func, collections_abc.Callable): + if not hasattr(func, 'write') or not isinstance(func.write, collections_abc.Callable): raise ValueError("Only callable can be used as callback") pyvals = umath.geterrobj() old = geterrcall() |