File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -532,14 +532,15 @@ def test_pyx_capi_make_from_memory():
532
532
any_usm_ndarray ,
533
533
"UsmNDArray_MakeFromMemory" ,
534
534
b"PyObject *(int, Py_ssize_t const *, int, "
535
- b"struct Py_MemoryObject *, Py_ssize_t)" ,
535
+ b"struct Py_MemoryObject *, Py_ssize_t, char )" ,
536
536
fn_restype = ctypes .py_object ,
537
537
fn_argtypes = (
538
538
ctypes .c_int ,
539
539
ctypes .POINTER (ctypes .c_ssize_t ),
540
540
ctypes .c_int ,
541
541
ctypes .py_object ,
542
542
ctypes .c_ssize_t ,
543
+ ctypes .c_char ,
543
544
),
544
545
)
545
546
r = make_from_memory_fn (
@@ -548,13 +549,31 @@ def test_pyx_capi_make_from_memory():
548
549
ctypes .c_int (typenum ),
549
550
mem ,
550
551
ctypes .c_ssize_t (0 ),
552
+ ctypes .c_char (b"C" ),
551
553
)
552
554
assert isinstance (r , dpt .usm_ndarray )
553
555
assert r .ndim == 2
554
556
assert r .shape == (n0 , n1 )
555
557
assert r ._pointer == mem ._pointer
556
558
assert r .usm_type == "shared"
557
559
assert r .sycl_queue == q
560
+ assert r .flags ["C" ]
561
+ r2 = make_from_memory_fn (
562
+ ctypes .c_int (2 ),
563
+ c_tuple ,
564
+ ctypes .c_int (typenum ),
565
+ mem ,
566
+ ctypes .c_ssize_t (0 ),
567
+ ctypes .c_char (b"F" ),
568
+ )
569
+ ptr = mem ._pointer
570
+ del mem
571
+ del r
572
+ assert isinstance (r2 , dpt .usm_ndarray )
573
+ assert r2 ._pointer == ptr
574
+ assert r2 .usm_type == "shared"
575
+ assert r2 .sycl_queue == q
576
+ assert r2 .flags ["F" ]
558
577
559
578
560
579
def test_pyx_capi_set_writable_flag ():
You can’t perform that action at this time.
0 commit comments