From 8c05c5d0c34c00cce8294e38fc6ed86865da9627 Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Tue, 21 Apr 2026 15:39:33 -0700 Subject: [PATCH 1/2] clean up error messages RawKernelArg and WorkGroupMemory error messages were incorrectly formatted --- dpctl/_sycl_queue.pyx | 45 ++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/dpctl/_sycl_queue.pyx b/dpctl/_sycl_queue.pyx index b0b8336788..8b656de2db 100644 --- a/dpctl/_sycl_queue.pyx +++ b/dpctl/_sycl_queue.pyx @@ -1703,25 +1703,28 @@ cdef class WorkGroupMemory: raise RuntimeError("Workgroup memory extension not available") if not (0 < len(args) < 3): - raise TypeError("WorkGroupMemory constructor takes 1 or 2 " - f"arguments, but {len(args)} were given") + raise TypeError( + "WorkGroupMemory constructor takes 1 or 2 arguments, but " + f"{len(args)} were given" + ) if len(args) == 1: if not isinstance(args[0], numbers.Integral): - raise TypeError("WorkGroupMemory single argument constructor" - "expects first argument to be `int`", - f"but got {type(args[0])}") + raise TypeError( + "WorkGroupMemory single argument constructor expects " + f"first argument to be `int` but got {type(args[0])}" + ) nbytes = (args[0]) else: if not isinstance(args[0], str): raise TypeError( - "WorkGroupMemory constructor expects first" - f"argument to be `str`, but got {type(args[0])}" + "WorkGroupMemory constructor expects first argument to be " + f"`str`, but got {type(args[0])}" ) if not isinstance(args[1], numbers.Integral): raise TypeError( - "WorkGroupMemory constructor expects second" - f"argument to be `int`, but got {type(args[1])}" + "WorkGroupMemory constructor expects second argument to " + f"be `int`, but got {type(args[1])}" ) dtype = (args[0]) count = (args[1]) @@ -1800,14 +1803,16 @@ cdef class RawKernelArg: raise RuntimeError("Raw kernel arg extension not available") if not (0 < len(args) < 3): - raise TypeError("RawKernelArg constructor takes 1 or 2 " - f"arguments, but {len(args)} were given") + raise TypeError( + "RawKernelArg constructor takes 1 or 2 arguments, but " + f"{len(args)} were given" + ) if len(args) == 1: if not _is_buffer(args[0]): - raise TypeError("RawKernelArg single argument constructor" - "expects argument to be buffer", - f"but got {type(args[0])}") + raise TypeError( + "RawKernelArg single argument constructor expects " + f"argument to be buffer but got {type(args[0])}") ret_code = PyObject_GetBuffer(args[0], &(_buffer), PyBUF_SIMPLE | PyBUF_ANY_CONTIGUOUS) @@ -1819,11 +1824,15 @@ cdef class RawKernelArg: _is_buf = True else: if not isinstance(args[0], numbers.Integral): - raise TypeError("RawKernelArg constructor expects first" - "argument to be `int`, but got {type(args[0])}") + raise TypeError( + "RawKernelArg constructor expects first argument to be " + f"`int`, but got {type(args[0])}" + ) if not isinstance(args[1], numbers.Integral): - raise TypeError("RawKernelArg constructor expects second" - "argument to be `int`, but got {type(args[1])}") + raise TypeError( + "RawKernelArg constructor expects second argument to be " + f"`int`, but got {type(args[1])}" + ) _is_buf = False count = args[0] From ae1286a4a7e269eb44d72b90b47a360f26858165 Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Wed, 22 Apr 2026 13:32:01 -0700 Subject: [PATCH 2/2] Fix error formatting in _sycl_queue --- dpctl/_sycl_queue.pyx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/dpctl/_sycl_queue.pyx b/dpctl/_sycl_queue.pyx index 8b656de2db..06342889b0 100644 --- a/dpctl/_sycl_queue.pyx +++ b/dpctl/_sycl_queue.pyx @@ -488,9 +488,8 @@ cdef DPCTLSyclEventRef _memcpy_impl( src_is_buf = True else: raise TypeError( - "Parameter `src` should have either type " - "`dpctl.memory._Memory` or a type that " - "supports Python buffer protocol" + "Parameter `src` should have either type `dpctl.memory._Memory` " + "or a type that supports Python buffer protocol" ) if isinstance(dst, _Memory): @@ -508,9 +507,8 @@ cdef DPCTLSyclEventRef _memcpy_impl( dst_is_buf = True else: raise TypeError( - "Parameter `dst` should have either type " - "`dpctl.memory._Memory` or a type that " - "supports Python buffer protocol" + "Parameter `dst` should have either type `dpctl.memory._Memory` " + "or a type that supports Python buffer protocol" ) if dep_events_count == 0 or dep_events is NULL: @@ -1592,7 +1590,8 @@ cdef class SyclQueue(_SyclQueue): else: raise TypeError( "dependent_events must either None, or a sequence of " - ":class:`dpctl.SyclEvent` objects") + "`dpctl.SyclEvent` objects" + ) if nDE > 0: depEvents = ( malloc(nDE*sizeof(DPCTLSyclEventRef))