diff --git a/src/bindings/python/flux/compat36.py b/src/bindings/python/flux/compat36.py index 4f72601f5579..50aa43f0151e 100644 --- a/src/bindings/python/flux/compat36.py +++ b/src/bindings/python/flux/compat36.py @@ -10,6 +10,7 @@ import signal + # strsignal() is only available on Python 3.8 and up def strsignal(signum): if signum == signal.SIGHUP: diff --git a/src/bindings/python/flux/job/info.py b/src/bindings/python/flux/job/info.py index e227272debb4..f7206c00b6e8 100644 --- a/src/bindings/python/flux/job/info.py +++ b/src/bindings/python/flux/job/info.py @@ -572,12 +572,9 @@ def inactive_reason(self): return f'Exception: type={self.exception.type}{note or ""}' elif self.returncode > 128: signum = self.returncode - 128 - # strsignal() is only available in - # Python 3.8 and up. flux-core's minimum is 3.6. - try: - from signal import strsignal - except ImportError: - from flux.compat36 import strsignal + # strsignal() is only available in Python 3.8 and up. + # flux-core's minimum is 3.6. Use compat library + from flux.compat36 import strsignal try: sigdesc = strsignal(signum) except ValueError: