@@ -319,16 +319,14 @@ cdef class SyclQueue(_SyclQueue):
319
319
raise SyclQueueCreationError(
320
320
" SYCL Context could not be created from '{}'." .format(arg)
321
321
)
322
- elif status == - 4 :
322
+ elif status == - 4 or status == - 6 :
323
323
if len_args == 2 :
324
324
arg = args
325
325
raise SyclQueueCreationError(
326
326
" SYCL Queue failed to be created from '{}'." .format(arg)
327
327
)
328
328
elif status == - 5 :
329
329
raise TypeError (" Input capsule {} contains a null pointer or could not be renamed" .format(arg))
330
- elif status == - 6 :
331
- raise " SYCL Queue failed to be created from '{}'." .format(arg)
332
330
333
331
cdef int _init_queue_from__SyclQueue(self , _SyclQueue other):
334
332
""" Copy data container _SyclQueue fields over.
@@ -601,12 +599,27 @@ cdef class SyclQueue(_SyclQueue):
601
599
602
600
return ret
603
601
604
- cpdef cpp_bool equals(self , SyclQueue q):
605
- """ Returns true if the SyclQueue argument has the same _queue_ref
602
+ cdef cpp_bool equals(self , SyclQueue q):
603
+ """ Returns true if the SyclQueue argument `q` has the same _queue_ref
606
604
as this SyclQueue.
607
605
"""
608
606
return DPCTLQueue_AreEq(self ._queue_ref, q.get_queue_ref())
609
607
608
+ def __eq__ (self , other ):
609
+ """
610
+ Returns True if two :class:`dpctl.SyclQueue` compared arguments have
611
+ the same underlying ``DPCTLSyclQueueRef`` object.
612
+
613
+ Returns:
614
+ :obj:`bool`: ``True`` if the two :class:`dpctl.SyclQueue` objects
615
+ point to the same ``DPCTLSyclQueueRef`` object, otherwise
616
+ ``False``.
617
+ """
618
+ if isinstance (other, SyclQueue):
619
+ return self .equals(< SyclQueue> other)
620
+ else :
621
+ return False
622
+
610
623
def get_sycl_backend (self ):
611
624
""" Returns the Sycl backend associated with the queue.
612
625
"""
0 commit comments