提交 0c7d0031 authored 作者: Frederic's avatar Frederic

Make CudaNdarray_NewDims always set the python exception.

上级 3e2b234f
...@@ -436,6 +436,7 @@ static int CudaNdarray_alloc_contiguous(CudaNdarray *self, const int nd, ...@@ -436,6 +436,7 @@ static int CudaNdarray_alloc_contiguous(CudaNdarray *self, const int nd,
/* /*
* Return a CudaNdarray whose 'nd' dimensions are set to dims, and allocated. * Return a CudaNdarray whose 'nd' dimensions are set to dims, and allocated.
* Set the python error.
*/ */
template<typename inttype> template<typename inttype>
static PyObject *CudaNdarray_NewDims(int nd, const inttype * dims) static PyObject *CudaNdarray_NewDims(int nd, const inttype * dims)
...@@ -448,6 +449,8 @@ static PyObject *CudaNdarray_NewDims(int nd, const inttype * dims) ...@@ -448,6 +449,8 @@ static PyObject *CudaNdarray_NewDims(int nd, const inttype * dims)
Py_DECREF(rval); Py_DECREF(rval);
return NULL; return NULL;
} }
}else{
PyErr_SetString(PyExc_MemoryError, "Failed to the CudaNdarray structure.");
} }
return (PyObject*)rval; return (PyObject*)rval;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论