Skip to content

Commit

Permalink
MAINT: change place where NPY_NO_DEPRECATED_API is defined in f2py.
Browse files Browse the repository at this point in the history
This makes sure to undef at the end, and by putting the define in the
C code it ensures that the error message is understandable.
  • Loading branch information
rgommers committed Nov 16, 2014
1 parent f14d5e1 commit fff6dee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions numpy/f2py/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
* $D"""+"""ate:$
* Do not edit this file directly unless you know what you are doing!!!
*/
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#ifdef __cplusplus
extern \"C\" {
#endif
Expand Down Expand Up @@ -232,6 +234,7 @@
#ifdef __cplusplus
}
#endif
#undef NPY_NO_DEPRECATED_API
""",
'separatorsfor':{'latexdoc':'\n\n',
'restdoc':'\n\n'},
Expand Down
3 changes: 3 additions & 0 deletions numpy/f2py/src/fortranobject.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#define FORTRANOBJECT_C
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include "fortranobject.h"

#ifdef __cplusplus
Expand Down Expand Up @@ -1032,4 +1033,6 @@ F2PyCapsule_Check(PyObject *ptr)
#ifdef __cplusplus
}
#endif

#undef NPY_NO_DEPRECATED_API
/************************* EOF fortranobject.c *******************************/
2 changes: 0 additions & 2 deletions numpy/f2py/src/fortranobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
extern "C" {
#endif

#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION

#include "Python.h"

#ifdef FORTRANOBJECT_C
Expand Down

0 comments on commit fff6dee

Please sign in to comment.