Skip to content

Commit

Permalink
FIX: Catch exceptions which are passed through sundials
Browse files Browse the repository at this point in the history
  • Loading branch information
aragilar committed Dec 12, 2024
1 parent 060e143 commit a7f1bdf
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# cython: embedsignature=True
from cpython.exc cimport PyErr_CheckSignals
from cpython.exc cimport PyErr_CheckSignals, PyErr_Occurred
from collections import namedtuple
from enum import IntEnum
import inspect
Expand Down Expand Up @@ -1877,6 +1877,9 @@ cdef class CVODE(BaseSundialsSolver):

while True:
flag = CVode(cv_mem, <sunrealtype> t, y, &t_out, CV_NORMAL)
if PyErr_Occurred() != NULL:
# This basically reraises the exception
return NULL

nv_s2ndarray(y, y_last)

Expand Down

0 comments on commit a7f1bdf

Please sign in to comment.