mirror of
https://github.com/opencv/opencv.git
synced 2026-07-25 21:33:04 +04:00
fix: preserve NumPY writeable flag in output arguments
This commit is contained in:
@@ -101,6 +101,13 @@ bool pyopencv_to(PyObject* o, Mat& m, const ArgInfo& info)
|
||||
|
||||
PyArrayObject* oarr = (PyArrayObject*) o;
|
||||
|
||||
if (info.outputarg && !PyArray_ISWRITEABLE(oarr))
|
||||
{
|
||||
failmsg("%s marked as output argument, but provided NumPy array "
|
||||
"marked as readonly", info.name);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool needcopy = false, needcast = false;
|
||||
int typenum = PyArray_TYPE(oarr), new_typenum = typenum;
|
||||
int type = typenum == NPY_UBYTE ? CV_8U :
|
||||
|
||||
Reference in New Issue
Block a user