summaryrefslogtreecommitdiff
path: root/numpy/f2py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/f2py')
-rwxr-xr-xnumpy/f2py/crackfortran.py4
-rwxr-xr-xnumpy/f2py/f2py2e.py5
-rw-r--r--numpy/f2py/tests/util.py2
3 files changed, 5 insertions, 6 deletions
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py
index 3ac9b80c8..c3ec792e3 100755
--- a/numpy/f2py/crackfortran.py
+++ b/numpy/f2py/crackfortran.py
@@ -3414,8 +3414,8 @@ if __name__ == "__main__":
try:
open(l).close()
files.append(l)
- except IOError as detail:
- errmess('IOError: %s\n' % str(detail))
+ except OSError as detail:
+ errmess(f'OSError: {detail!s}\n')
else:
funcs.append(l)
if not strictf77 and f77modulename and not skipemptyends:
diff --git a/numpy/f2py/f2py2e.py b/numpy/f2py/f2py2e.py
index f2093d76c..f45374be6 100755
--- a/numpy/f2py/f2py2e.py
+++ b/numpy/f2py/f2py2e.py
@@ -275,9 +275,8 @@ def scaninputline(inputline):
with open(l):
pass
files.append(l)
- except IOError as detail:
- errmess('IOError: %s. Skipping file "%s".\n' %
- (str(detail), l))
+ except OSError as detail:
+ errmess(f'OSError: {detail!s}. Skipping file "{l!s}".\n')
elif f == -1:
skipfuncs.append(l)
elif f == 0:
diff --git a/numpy/f2py/tests/util.py b/numpy/f2py/tests/util.py
index d5fa76fed..eace3c9fc 100644
--- a/numpy/f2py/tests/util.py
+++ b/numpy/f2py/tests/util.py
@@ -36,7 +36,7 @@ def _cleanup():
pass
try:
shutil.rmtree(_module_dir)
- except (IOError, OSError):
+ except OSError:
pass
_module_dir = None