def dump_traceback_later(self, timeout, repeat, w_file, exit): space = self.space timeout *= 1e6 try: microseconds = ovfcheck_float_to_longlong(timeout) except OverflowError: raise oefmt(space.w_OverflowError, "timeout value is too large") if microseconds <= 0: raise oefmt(space.w_ValueError, "timeout must be greater than 0") fileno, w_file = self.get_fileno_and_file(w_file) self.setup() self.check_err( cintf.pypy_faulthandler_dump_traceback_later( rffi.cast(rffi.LONGLONG, microseconds), rffi.cast(rffi.INT, repeat), rffi.cast(rffi.INT, fileno), rffi.cast(rffi.INT, exit))) self.dump_traceback_later_w_file = w_file
def dump_traceback_later(self, timeout, repeat, w_file, exit): space = self.space timeout *= 1e6 try: microseconds = ovfcheck_float_to_longlong(timeout) except OverflowError: raise oefmt(space.w_OverflowError, "timeout value is too large") if microseconds <= 0: raise oefmt(space.w_ValueError, "timeout must be greater than 0") fileno, w_file = self.get_fileno_and_file(w_file) self.setup() self.check_err(cintf.pypy_faulthandler_dump_traceback_later( rffi.cast(rffi.LONGLONG, microseconds), rffi.cast(rffi.INT, repeat), rffi.cast(rffi.INT, fileno), rffi.cast(rffi.INT, exit))) self.dump_traceback_later_w_file = w_file
def parse_acquire_args(space, blocking, timeout): if not blocking and timeout != -1.0: raise oefmt(space.w_ValueError, "can't specify a timeout for a non-blocking call") if timeout < 0.0 and timeout != -1.0: raise oefmt(space.w_ValueError, "timeout value must be strictly positive") if not blocking: microseconds = 0 elif timeout == -1.0: microseconds = -1 else: timeout *= 1e6 try: microseconds = ovfcheck_float_to_longlong(timeout) except OverflowError: raise oefmt(space.w_OverflowError, "timeout value is too large") return microseconds
def timestamp_w(space, w_secs): if space.isinstance_w(w_secs, space.w_float): secs = space.float_w(w_secs) if math.isnan(secs): raise oefmt(space.w_ValueError, "timestamp is nan") result_float = math.ceil(secs * SECS_TO_NS) try: return ovfcheck_float_to_longlong(result_float) except OverflowError: raise oefmt(space.w_OverflowError, "timestamp %R too large to convert to C _PyTime_t", w_secs) else: try: sec = space.bigint_w(w_secs).tolonglong() result = sec * r_longlong(SECS_TO_NS) except OverflowError: raise oefmt(space.w_OverflowError, "timestamp %R too large to convert to C _PyTime_t", w_secs) return result