diff options
Diffstat (limited to 'numpy/core')
| -rw-r--r-- | numpy/core/code_generators/genapi.py | 2 | ||||
| -rw-r--r-- | numpy/core/numeric.py | 8 | ||||
| -rw-r--r-- | numpy/core/numerictypes.py | 4 | ||||
| -rw-r--r-- | numpy/core/records.py | 4 | ||||
| -rw-r--r-- | numpy/core/setup.py | 2 | ||||
| -rw-r--r-- | numpy/core/tests/test_extint128.py | 2 | ||||
| -rw-r--r-- | numpy/core/tests/test_indexing.py | 4 | ||||
| -rw-r--r-- | numpy/core/tests/test_multiarray.py | 2 | ||||
| -rw-r--r-- | numpy/core/tests/test_nditer.py | 2 | ||||
| -rw-r--r-- | numpy/core/tests/test_regression.py | 2 |
10 files changed, 16 insertions, 16 deletions
diff --git a/numpy/core/code_generators/genapi.py b/numpy/core/code_generators/genapi.py index a64d62e6e..e4651de3b 100644 --- a/numpy/core/code_generators/genapi.py +++ b/numpy/core/code_generators/genapi.py @@ -272,7 +272,7 @@ def find_functions(filename, tag='API'): state = SCANNING else: function_args.append(line) - except: + except Exception: print(filename, lineno + 1) raise fo.close() diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 1dde02400..9073ca5ff 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1278,7 +1278,7 @@ def tensordot(a, b, axes=2): """ try: iter(axes) - except: + except Exception: axes_a = list(range(-axes, 0)) axes_b = list(range(0, axes)) else: @@ -2597,7 +2597,7 @@ def array_equal(a1, a2): """ try: a1, a2 = asarray(a1), asarray(a2) - except: + except Exception: return False if a1.shape != a2.shape: return False @@ -2641,11 +2641,11 @@ def array_equiv(a1, a2): """ try: a1, a2 = asarray(a1), asarray(a2) - except: + except Exception: return False try: multiarray.broadcast(a1, a2) - except: + except Exception: return False return bool(asarray(a1 == a2).all()) diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py index 600d5af33..be3829ea1 100644 --- a/numpy/core/numerictypes.py +++ b/numpy/core/numerictypes.py @@ -597,7 +597,7 @@ def issctype(rep): if res and res != object_: return True return False - except: + except Exception: return False def obj2sctype(rep, default=None): @@ -652,7 +652,7 @@ def obj2sctype(rep, default=None): return rep.dtype.type try: res = dtype(rep) - except: + except Exception: return default return res.type diff --git a/numpy/core/records.py b/numpy/core/records.py index ecc293812..9404de8d2 100644 --- a/numpy/core/records.py +++ b/numpy/core/records.py @@ -473,7 +473,7 @@ class recarray(ndarray): newattr = attr not in self.__dict__ try: ret = object.__setattr__(self, attr, val) - except: + except Exception: fielddict = ndarray.__getattribute__(self, 'dtype').fields or {} if attr not in fielddict: exctype, value = sys.exc_info()[:2] @@ -487,7 +487,7 @@ class recarray(ndarray): # internal attribute. try: object.__delattr__(self, attr) - except: + except Exception: return ret try: res = fielddict[attr][:2] diff --git a/numpy/core/setup.py b/numpy/core/setup.py index f268258ee..0be0bd65a 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -187,7 +187,7 @@ def check_complex(config, mathlibs): if os.uname()[0] == "Interix": warnings.warn("Disabling broken complex support. See #1365", stacklevel=2) return priv, pub - except: + except Exception: # os.uname not available on all platforms. blanket except ugly but safe pass diff --git a/numpy/core/tests/test_extint128.py b/numpy/core/tests/test_extint128.py index 755ee2c04..d87585dcf 100644 --- a/numpy/core/tests/test_extint128.py +++ b/numpy/core/tests/test_extint128.py @@ -59,7 +59,7 @@ def exc_iter(*args): try: yield iterate() - except: + except Exception: import traceback msg = "At: %r\n%s" % (repr(value[0]), traceback.format_exc()) diff --git a/numpy/core/tests/test_indexing.py b/numpy/core/tests/test_indexing.py index 55eeb694a..1f8efe38d 100644 --- a/numpy/core/tests/test_indexing.py +++ b/numpy/core/tests/test_indexing.py @@ -847,7 +847,7 @@ class TestMultiIndexingAutomated(TestCase): try: flat_indx = np.ravel_multi_index(np.nonzero(indx), arr.shape[ax:ax+indx.ndim], mode='raise') - except: + except Exception: error_unless_broadcast_to_empty = True # fill with 0s instead, and raise error later flat_indx = np.array([0]*indx.sum(), dtype=np.intp) @@ -946,7 +946,7 @@ class TestMultiIndexingAutomated(TestCase): try: mi = np.ravel_multi_index(indx[1:], orig_slice, mode='raise') - except: + except Exception: # This happens with 0-sized orig_slice (sometimes?) # here it is a ValueError, but indexing gives a: raise IndexError('invalid index into 0-sized') diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 052cc2dad..17235a60b 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -6355,7 +6355,7 @@ def test_flat_element_deletion(): del it[1:2] except TypeError: pass - except: + except Exception: raise AssertionError diff --git a/numpy/core/tests/test_nditer.py b/numpy/core/tests/test_nditer.py index 77521317e..1bcc13bdc 100644 --- a/numpy/core/tests/test_nditer.py +++ b/numpy/core/tests/test_nditer.py @@ -2641,7 +2641,7 @@ def test_iter_element_deletion(): del it[1:2] except TypeError: pass - except: + except Exception: raise AssertionError def test_iter_allocated_array_dtypes(): diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py index fb9ea5252..f503e0e02 100644 --- a/numpy/core/tests/test_regression.py +++ b/numpy/core/tests/test_regression.py @@ -1807,7 +1807,7 @@ class TestRegression(TestCase): a['f2'] = 1 except ValueError: pass - except: + except Exception: raise AssertionError def test_ticket_1608(self): |
