From a094ca3b39a94f597eabb090ccf4d5810bf626d3 Mon Sep 17 00:00:00 2001 From: shivam Date: Tue, 16 Jun 2026 18:35:09 +0530 Subject: [PATCH] fix(ptrace): resolve OverflowError on riscv64 FTBFS Replace the signed c_long conversion with unsigned comparison against c_ulong(-1), as _ptrace.restype is already c_ulong. Large unsigned ptrace return values (which is common on riscv64) were overflowing the signed conversion. Fixes #1087588 --- ptrace/binding/func.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ptrace/binding/func.py b/ptrace/binding/func.py index ca70659..16a9fae 100644 --- a/ptrace/binding/func.py +++ b/ptrace/binding/func.py @@ -135,7 +135,7 @@ HAS_CPTRACE = True except ImportError: HAS_CPTRACE = False - from ctypes import c_long, c_ulong + from ctypes import c_ulong from ptrace.ctypes_libc import libc # Load ptrace() function from the system C library @@ -155,8 +155,8 @@ def ptrace(command, pid=0, arg1=0, arg2=0, check_errno=False): raise PtraceError(message, errno=errno, pid=pid) else: result = _ptrace(command, pid, arg1, arg2) - result_signed = c_long(result).value - if result_signed == -1: + result_unsigned = c_ulong(result).value + if result_unsigned == c_ulong(-1).value: errno = get_errno() # peek operations may returns -1 with errno=0: # it's not an error. For other operations, -1