diff --git a/pymc/sampling/mcmc.py b/pymc/sampling/mcmc.py index b4c607aa01..2a65a7209e 100644 --- a/pymc/sampling/mcmc.py +++ b/pymc/sampling/mcmc.py @@ -1300,12 +1300,7 @@ def _iter_sample( ) yield diverging - except KeyboardInterrupt: - if isinstance(trace, ZarrChain): - trace.record_sampling_state(step=step) - trace.close() - raise - except BaseException: + except (KeyboardInterrupt, BaseException): if isinstance(trace, ZarrChain): trace.record_sampling_state(step=step) trace.close()