diff --git a/src/bispectrum/so3_on_s2.py b/src/bispectrum/so3_on_s2.py index 2384eba..2875953 100644 --- a/src/bispectrum/so3_on_s2.py +++ b/src/bispectrum/so3_on_s2.py @@ -28,6 +28,7 @@ import hashlib import logging +import pickle # nosec B403 — only used for UnpicklingError type reference from collections import OrderedDict from pathlib import Path @@ -520,7 +521,7 @@ def _load_sparse_cache( if cached_meta != expected_meta: return None return data['cg_vals'], data['m1_idx'], data['m_idx'], data['offsets'], cached_meta - except Exception: + except (OSError, RuntimeError, KeyError, pickle.UnpicklingError): return None def _build_group_tables(