From: Jérôme Benoit Date: Fri, 1 May 2026 15:29:28 +0000 (+0200) Subject: fix: narrow bare except to specific types in statistical helpers X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=e66494720696ec711909651b91ef82c14d865f55;p=freqai-strategies.git fix: narrow bare except to specific types in statistical helpers --- diff --git a/quickadapter/user_data/strategies/QuickAdapterV3.py b/quickadapter/user_data/strategies/QuickAdapterV3.py index 1efd146..01a8d79 100644 --- a/quickadapter/user_data/strategies/QuickAdapterV3.py +++ b/quickadapter/user_data/strategies/QuickAdapterV3.py @@ -1912,7 +1912,8 @@ class QuickAdapterV3(IStrategy): try: rho1, _ = pearsonr(x_centered[:-1], x_centered[1:]) - except Exception: + except (ValueError, TypeError) as exc: + logger.debug("[%s] pearsonr failed, using standard df: %r", "effective_df", exc) return n - 1 if not np.isfinite(rho1): @@ -1949,7 +1950,8 @@ class QuickAdapterV3(IStrategy): if not np.isfinite(t_crit): return default_t return t_crit - except Exception: + except (ValueError, TypeError, OverflowError) as exc: + logger.debug("[%s] t.ppf failed, using default_t: %r", "t_critical", exc) return default_t def custom_exit(