@@ -817,7 +817,9 @@ def ensure_interruptible_after(seconds: float, max_wait_after_interrupt: float =
817817    The test above requires a large tolerance, because both ``time.sleep`` and 
818818    ``from posix.unistd cimport usleep`` may have slowdown on the order of 0.1s on Mac, 
819819    likely because the system is idle and GitHub CI switches the program out, 
820-     and context switch back takes time. So we use busy wait instead:: 
820+     and context switch back takes time. Besides, there is an issue with ``Integer`` 
821+     destructor, see `<https://github.com/sagemath/cysignals/issues/215>`_ 
822+     So we use busy wait and Python integers:: 
821823
822824        sage: # needs sage.misc.cython 
823825        sage: cython(r''' 
@@ -841,17 +843,17 @@ def ensure_interruptible_after(seconds: float, max_wait_after_interrupt: float =
841843        ....:         if start_time.tv_sec > target_time.tv_sec or (start_time.tv_sec == target_time.tv_sec and start_time.tv_nsec >= target_time.tv_nsec): 
842844        ....:             break 
843845        ....: ''') 
844-         sage: with ensure_interruptible_after(2) as data: interruptible_sleep(1 ) 
846+         sage: with ensure_interruptible_after(2) as data: interruptible_sleep(1r ) 
845847        Traceback (most recent call last): 
846848        ... 
847849        RuntimeError: Function terminates early after 1.00... < 2.0000 seconds 
848-         sage: with ensure_interruptible_after(1) as data: uninterruptible_sleep(2 ) 
850+         sage: with ensure_interruptible_after(1) as data: uninterruptible_sleep(2r ) 
849851        Traceback (most recent call last): 
850852        ... 
851853        RuntimeError: Function is not interruptible within 1.0000 seconds, only after 2.00... seconds 
852854        sage: data  # abs tol 0.01 
853855        {'alarm_raised': True, 'elapsed': 2.0} 
854-         sage: with ensure_interruptible_after(1): uninterruptible_sleep(2 ); raise RuntimeError 
856+         sage: with ensure_interruptible_after(1): uninterruptible_sleep(2r ); raise RuntimeError 
855857        Traceback (most recent call last): 
856858        ... 
857859        RuntimeError: Function is not interruptible within 1.0000 seconds, only after 2.00... seconds 
@@ -870,7 +872,7 @@ def ensure_interruptible_after(seconds: float, max_wait_after_interrupt: float =
870872    seconds  =  float (seconds )
871873    max_wait_after_interrupt  =  float (max_wait_after_interrupt )
872874    inaccuracy_tolerance  =  float (inaccuracy_tolerance )
873-     # use Python float to avoid unexplained  slowdown with Sage objects  
875+     # use Python float to avoid slowdown with Sage Integer (see https://github.com/sagemath/cysignals/issues/215)  
874876    data  =  {}
875877    start_time  =  walltime ()
876878    alarm (seconds )
0 commit comments