diff options
Diffstat (limited to 'numpy/matrixlib/defmatrix.py')
-rw-r--r-- | numpy/matrixlib/defmatrix.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/matrixlib/defmatrix.py b/numpy/matrixlib/defmatrix.py index d1a1211aa..a13ff23f4 100644 --- a/numpy/matrixlib/defmatrix.py +++ b/numpy/matrixlib/defmatrix.py @@ -1024,8 +1024,8 @@ def _from_string(str, gdict, ldict): except KeyError: try: thismat = gdict[col] - except KeyError: - raise KeyError("%s not found" % (col,)) + except KeyError as e: + raise NameError(f"name {col!r} is not defined") from None coltup.append(thismat) rowtup.append(concatenate(coltup, axis=-1)) |