Error using if numba cuda nvidia bindings are used

Follow up to post CUDA - OpenGL interop

Setting NUMBA_CUDA_USE_NVIDIA_BINDING=1 before running the code
below results in error.

Un-setting the var does not produce error.

import ctypes
import numpy as np
from cuda import cudart
from cuda.cudart import cudaGraphicsRegisterFlags as GLFlags
import numba.cuda as nbcuda
import moderngl as mgl

###################################################
# wrap the raw pointer into DeviceNDArray
def gl_NDArray(ptr, shape, dtype=np.float32, strides=None, order="C"):
    shape, strides, dtype = nbcuda.api.prepare_shape_strides_dtype(
        shape, strides, dtype, order
    )
    datasize = nbcuda.driver.memory_size_from_info(shape, strides, dtype.itemsize)

    ctx = nbcuda.current_context()
    c_ptr = ctypes.c_uint64(ptr)
    mem = nbcuda.driver.MemoryPointer(ctx, c_ptr, datasize)
    return nbcuda.cudadrv.devicearray.DeviceNDArray(shape, strides, dtype, gpu_data=mem)



ctx = mgl.create_context(standalone=True)


# vertices for triangle with Red Green and Blue colors
vertices = np.array(
    # X     Y                   x     y                   x    y
    [-0.6, -0.6, 1.0, 0.0, 0.0, 0.6, -0.6, 0.0, 1.0, 0.0, 0.0, 0.6, 0.0, 0.0, 1.0],
    dtype="f4",
)

# init VBO
vbo = ctx.buffer(vertices)

# Get CUDA pointer to VBO
err, gl_resource = cudart.cudaGraphicsGLRegisterBuffer(
    vbo.glo, GLFlags.cudaGraphicsRegisterFlagsNone 
)
(err,) = cudart.cudaGraphicsMapResources(1, gl_resource, 0)

# get raw pointer to device array
(err, dev_ptr, dev_ptr_size) = cudart.cudaGraphicsResourceGetMappedPointer(gl_resource)
# wrap into DeviceNDArray
vbo_arr = gl_NDArray(dev_ptr, vertices.size)

# fails here
a = vbo_arr.copy_to_host()
print(a)

Below error happens on if NUMBA_CUDA_USE_NVIDIA_BINDING=1.

Traceback (most recent call last):
  File "C:\Users\k1m19\OneDrive\Desktop\CUDA_RAPIDS\debug_code1.py", line 48, in <module>
    a = vbo_arr.copy_to_host()
  File "D:\PY\mamba\envs\cuda_learn_1\lib\site-packages\numba\cuda\cudadrv\devices.py", line 232, in _require_cuda_context
    return fn(*args, **kws)
  File "D:\PY\mamba\envs\cuda_learn_1\lib\site-packages\numba\cuda\cudadrv\devicearray.py", line 277, in copy_to_host
    _driver.device_to_host(hostary, self, self.alloc_size,
  File "D:\PY\mamba\envs\cuda_learn_1\lib\site-packages\numba\cuda\cudadrv\driver.py", line 3230, in device_to_host
    fn(host_pointer(dst), device_pointer(src), size, *varargs)
  File "D:\PY\mamba\envs\cuda_learn_1\lib\site-packages\numba\cuda\cudadrv\driver.py", line 361, in safe_cuda_api_call
    return self._check_cuda_python_error(fname, libfn(*args))
  File "cuda\cuda.pyx", line 18103, in cuda.cuda.cuMemcpyDtoH
  File "cuda\cuda.pyx", line 3785, in cuda.cuda.CUdeviceptr.__cinit__
TypeError: an integer is required