Skip to content

Commit 88fbf1a

Browse files
author
Release Manager
committed
gh-35044: #27428 fix use of sig_on()/sig_off() in CBF.integral() URL: #35044 Reported by: Marc Mezzarobba Reviewer(s): Frédéric Chapoton
2 parents f449b14 + 121c010 commit 88fbf1a

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/sage/rings/complex_arb.pyx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Classes and Methods
145145
import operator
146146
import sys
147147
import warnings
148-
from cysignals.signals cimport sig_on, sig_str, sig_off, sig_error
148+
from cysignals.signals cimport sig_on, sig_str, sig_off, sig_error, sig_block, sig_unblock
149149

150150
import sage.categories.fields
151151

@@ -284,27 +284,27 @@ cdef int acb_calc_func_callback(acb_ptr out, const acb_t inp, void * param,
284284
"""
285285
cdef IntegrationContext ctx
286286
cdef ComplexBall x
287-
sig_off()
287+
sig_block()
288288
try:
289289
ctx = <IntegrationContext>param
290290
if ctx.exn_type is not None or order >= 2:
291291
acb_indeterminate(out)
292292
return 0
293-
x = ComplexBall.__new__(ComplexBall)
294-
assert prec == ctx.parent._prec
295-
x._parent = ctx.parent
296-
acb_set(x.value, inp)
297293
try:
294+
x = ComplexBall.__new__(ComplexBall)
295+
assert prec == ctx.parent._prec
296+
x._parent = ctx.parent
297+
acb_set(x.value, inp)
298298
y = ctx.f(x, (order == 1))
299299
if not isinstance(y, ComplexBall):
300300
y = ctx.parent.coerce(y)
301301
acb_set(out, (<ComplexBall> y).value)
302-
except Exception:
302+
except BaseException:
303303
ctx.exn_type, ctx.exn_obj, ctx.exn_tb = sys.exc_info()
304304
acb_indeterminate(out)
305305
return 0
306306
finally:
307-
sig_on()
307+
sig_unblock()
308308

309309

310310
class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField):
@@ -1175,6 +1175,14 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField):
11751175
11761176
sage: ComplexBallField(100).integral(lambda x, _: sin(x), RBF(0), RBF(1))
11771177
[0.4596976941318602825990633926 +/- ...e-29]
1178+
1179+
sage: from cysignals.alarm import alarm
1180+
sage: alarm(0.1r)
1181+
sage: C = ComplexBallField(1000000)
1182+
sage: C.integral(lambda x, _: x.cos() * x.sin(), 0, 1)
1183+
Traceback (most recent call last):
1184+
...
1185+
AlarmInterrupt
11781186
"""
11791187
cdef IntegrationContext ctx = IntegrationContext()
11801188
cdef acb_calc_integrate_opt_t arb_opts

0 commit comments

Comments
 (0)