8000 Merge pull request #28128 from arachnist/bug_c90_violation_generate_n… · melissawm/numpy@2777fa6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2777fa6

Browse files
authored
Merge pull request numpy#28128 from arachnist/bug_c90_violation_generate_numpy_api
BUG: Don't use C99 construct in import_array
2 parents d02bde8 + cebd52a commit 2777fa6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

numpy/_core/code_generators/generate_numpy_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
{
6666
int st;
6767
PyObject *numpy = PyImport_ImportModule("numpy._core._multiarray_umath");
68+
PyObject *c_api;
6869
if (numpy == NULL && PyErr_ExceptionMatches(PyExc_ModuleNotFoundError)) {
6970
PyErr_Clear();
7071
numpy = PyImport_ImportModule("numpy.core._multiarray_umath");
@@ -74,7 +75,7 @@
7475
return -1;
7576
}
7677
77-
PyObject *c_api = PyObject_GetAttrString(numpy, "_ARRAY_API");
78+
c_api = PyObject_GetAttrString(numpy, "_ARRAY_API");
7879
Py_DECREF(numpy);
7980
if (c_api == NULL) {
8081
return -1;

numpy/_core/code_generators/generate_ufunc_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
static inline int
3939
_import_umath(void)
4040
{
41+
PyObject *c_api;
4142
PyObject *numpy = PyImport_ImportModule("numpy._core._multiarray_umath");
4243
if (numpy == NULL && PyErr_ExceptionMatches(PyExc_ModuleNotFoundError)) {
4344
PyErr_Clear();
@@ -50,7 +51,7 @@
5051
return -1;
5152
}
5253
53-
PyObject *c_api = PyObject_GetAttrString(numpy, "_UFUNC_API");
54+
c_api = PyObject_GetAttrString(numpy, "_UFUNC_API");
5455
Py_DECREF(numpy);
5556
if (c_api == NULL) {
5657
PyErr_SetString(PyExc_AttributeError, "_UFUNC_API not found");

0 commit comments

Comments
 (0)
0