Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit54529e2

Browse files
committed
BUG: Avoid compile errors in f2py modules
Some of the casts from cfuncs pass PyObject* to PyArrayObject*, whichcauses compile errors due to incompatible pointer types on at leastGCC 14.
1 parentbbdebae commit54529e2

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

‎numpy/f2py/cfuncs.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,9 +1047,12 @@ def errmess(s: str) -> None:
10471047
PyArray_ScalarAsCtype(obj, v);
10481048
return 1;
10491049
}
1050-
else if (PyArray_Check(obj) && PyArray_TYPE(obj) == NPY_LONGDOUBLE) {
1051-
(*v) = *((npy_longdouble *)PyArray_DATA(obj));
1052-
return 1;
1050+
else if (PyArray_Check(obj)) {
1051+
PyArrayObject *arr = (PyArrayObject *)obj;
1052+
if (PyArray_TYPE(arr) == NPY_LONGDOUBLE) {
1053+
(*v) = *((npy_longdouble *)PyArray_DATA(arr));
1054+
return 1;
1055+
}
10531056
}
10541057
}
10551058
if (double_from_pyobj(&d, obj, errmess)) {
@@ -1131,10 +1134,13 @@ def errmess(s: str) -> None:
11311134
PyArray_ScalarAsCtype(obj, v);
11321135
return 1;
11331136
}
1134-
else if (PyArray_Check(obj) && PyArray_TYPE(obj)==NPY_CLONGDOUBLE) {
1135-
(*v).r = npy_creall(*(((npy_clongdouble *)PyArray_DATA(obj))));
1136-
(*v).i = npy_cimagl(*(((npy_clongdouble *)PyArray_DATA(obj))));
1137-
return 1;
1137+
else if (PyArray_Check(obj)) {
1138+
PyArrayObject *arr = (PyArrayObject *)obj;
1139+
if (PyArray_TYPE(arr)==NPY_CLONGDOUBLE) {
1140+
(*v).r = npy_creall(*(((npy_clongdouble *)PyArray_DATA(arr))));
1141+
(*v).i = npy_cimagl(*(((npy_clongdouble *)PyArray_DATA(arr))));
1142+
return 1;
1143+
}
11381144
}
11391145
}
11401146
if (complex_double_from_pyobj(&cd,obj,errmess)) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp