From eb2a9384a644c9731d1d90c2ea3866e942edb48c Mon Sep 17 00:00:00 2001
From: Stefan Bienert <stefan.bienert@unibas.ch>
Date: Mon, 10 Feb 2020 11:11:53 +0100
Subject: [PATCH] SCHWED-4612: Reduce Numpy compilation warnings

---
 modules/mol/base/pymod/export_editors.cc | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/mol/base/pymod/export_editors.cc b/modules/mol/base/pymod/export_editors.cc
index 50aa16842..ebdbcf2b2 100644
--- a/modules/mol/base/pymod/export_editors.cc
+++ b/modules/mol/base/pymod/export_editors.cc
@@ -29,7 +29,15 @@ using namespace boost::python;
 using namespace ost;
 using namespace ost::mol;
 
+/* Including NumPy headers produces compiler warnings. The ones about "Using
+   deprecated NumPy API..." we can not get rid of. The highest NumPy version we
+   support is 1.6 while the non-deprecated API starts with version 1.7.
+   Also see the comment in modules/gfx/pymod/export_primlist.cc for further
+   information.
+*/
 #if OST_NUMPY_SUPPORT_ENABLED
+#include <numpy/numpyconfig.h>
+#define NPY_NO_DEPRECATED_API NPY_1_6_API_VERSION
 #include <numpy/arrayobject.h>
 #endif
 
@@ -228,6 +236,7 @@ void export_Editors()
 {
 #if OST_NUMPY_SUPPORT_ENABLED
   // The following define enforces no return value when calling import_array
+  #undef NUMPY_IMPORT_ARRAY_RETVAL
   #define NUMPY_IMPORT_ARRAY_RETVAL
   import_array();
 #endif
-- 
GitLab