Skip to content

Commit

Permalink
change to suitable raise from and add line breaks #2
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyhvo12 committed Apr 5, 2021
1 parent 3cbfdba commit fdeb979
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion numpy/random/_common.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ cdef object prepare_cffi(bitgen_t *bitgen):
"""
try:
import cffi
except ImportError:
except ImportError as e:
raise ImportError('cffi cannot be imported.') from e

ffi = cffi.FFI()
Expand Down
6 changes: 3 additions & 3 deletions tools/cythonize.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ def process_pyx(fromfile, tofile):
# try the cython in the installed python first (somewhat related to scipy/scipy#2397)
import Cython
from Cython.Compiler.Version import version as cython_version
except ImportError:
except ImportError as e:
# The `cython` command need not point to the version installed in the
# Python running this script, so raise an error to avoid the chance of
# using the wrong version of Cython.
raise OSError("Cython needs to be installed in "
"Python as a module") from e
msg = 'Cython needs to be installed in Python as a module'
raise OSError(msg) from e
else:
# check the version, and invoke through python
from distutils.version import LooseVersion
Expand Down

0 comments on commit fdeb979

Please sign in to comment.