summaryrefslogtreecommitdiff
path: root/numpy/f2py/src/fortranobject.c
diff options
context:
space:
mode:
authorPearu Peterson <pearu.peterson@gmail.com>2021-02-07 21:54:48 +0200
committerPearu Peterson <pearu.peterson@gmail.com>2021-02-07 22:25:27 +0200
commit4874af99fcb9c9af869536a2bd390e9e94d07b8a (patch)
treefb2dabeeefb741df176d21059b929a4ab905b454 /numpy/f2py/src/fortranobject.c
parentea557b2c6c681f029cfee1ea3ddf0b6e87f2dab5 (diff)
downloadnumpy-4874af99fcb9c9af869536a2bd390e9e94d07b8a.tar.gz
ENH: Share memory of read-only intent(in) arrays. Closes #16347
Diffstat (limited to 'numpy/f2py/src/fortranobject.c')
-rw-r--r--numpy/f2py/src/fortranobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/f2py/src/fortranobject.c b/numpy/f2py/src/fortranobject.c
index 3275f90ad..b9ef18701 100644
--- a/numpy/f2py/src/fortranobject.c
+++ b/numpy/f2py/src/fortranobject.c
@@ -799,7 +799,7 @@ PyArrayObject* array_from_pyobj(const int type_num,
&& ARRAY_ISCOMPATIBLE(arr,type_num)
&& F2PY_CHECK_ALIGNMENT(arr, intent)
) {
- if ((intent & F2PY_INTENT_C)?PyArray_ISCARRAY(arr):PyArray_ISFARRAY(arr)) {
+ if ((intent & F2PY_INTENT_C)?PyArray_ISCARRAY_RO(arr):PyArray_ISFARRAY_RO(arr)) {
if ((intent & F2PY_INTENT_OUT)) {
Py_INCREF(arr);
}
@@ -807,9 +807,9 @@ PyArrayObject* array_from_pyobj(const int type_num,
return arr;
}
}
-
if (intent & F2PY_INTENT_INOUT) {
strcpy(mess, "failed to initialize intent(inout) array");
+ /* Must use PyArray_IS*ARRAY because intent(inout) requires writable input */
if ((intent & F2PY_INTENT_C) && !PyArray_ISCARRAY(arr))
strcat(mess, " -- input not contiguous");
if (!(intent & F2PY_INTENT_C) && !PyArray_ISFARRAY(arr))