Skip to content

Commit 8a51518

Browse files
authored
Merge pull request #46 from geometric-intelligence/johmathe/narrow-cache-exception
Narrow cache load exception handler
2 parents b1111a2 + 712ffa8 commit 8a51518

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/bispectrum/so3_on_s2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import hashlib
3030
import logging
31+
import pickle # nosec B403 — only used for UnpicklingError type reference
3132
from collections import OrderedDict
3233
from pathlib import Path
3334

@@ -520,7 +521,7 @@ def _load_sparse_cache(
520521
if cached_meta != expected_meta:
521522
return None
522523
return data['cg_vals'], data['m1_idx'], data['m_idx'], data['offsets'], cached_meta
523-
except Exception:
524+
except (OSError, RuntimeError, KeyError, pickle.UnpicklingError):
524525
return None
525526

526527
def _build_group_tables(

0 commit comments

Comments
 (0)