Skip to content

Commit fdeb979

Browse files
committed
change to suitable raise from and add line breaks #2
1 parent 3cbfdba commit fdeb979

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

numpy/random/_common.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ cdef object prepare_cffi(bitgen_t *bitgen):
121121
"""
122122
try:
123123
import cffi
124-
except ImportError:
124+
except ImportError as e:
125125
raise ImportError('cffi cannot be imported.') from e
126126

127127
ffi = cffi.FFI()

tools/cythonize.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ def process_pyx(fromfile, tofile):
5858
# try the cython in the installed python first (somewhat related to scipy/scipy#2397)
5959
import Cython
6060
from Cython.Compiler.Version import version as cython_version
61-
except ImportError:
61+
except ImportError as e:
6262
# The `cython` command need not point to the version installed in the
6363
# Python running this script, so raise an error to avoid the chance of
6464
# using the wrong version of Cython.
65-
raise OSError("Cython needs to be installed in "
66-
"Python as a module") from e
65+
msg = 'Cython needs to be installed in Python as a module'
66+
raise OSError(msg) from e
6767
else:
6868
# check the version, and invoke through python
6969
from distutils.version import LooseVersion

0 commit comments

Comments
 (0)