38c9e4
From 0fce0e589353d772ceda4d493b147138406b22fd Mon Sep 17 00:00:00 2001
38c9e4
From: =?UTF-8?q?Moritz=20Wanzenb=C3=B6ck?= <moritz.wanzenboeck@catalysts.cc>
38c9e4
Date: Wed, 11 Jul 2018 11:57:46 +0200
38c9e4
Subject: [PATCH] Add missing return statement in numpy import
38c9e4
38c9e4
This adds a missing return statement in the python3 specific
38c9e4
import logic of boost.python.numpy.
38c9e4
38c9e4
For python3 wrap_import_array() needs to return a pointer value.
38c9e4
The import_array() macro only returns NULL in case of error. The
38c9e4
missing return statement is UB, so the compiler can assume it does
38c9e4
not happen. This means the compiler can assume the error branch
38c9e4
is always taken, so import_array must always fail.
38c9e4
---
38c9e4
 src/numpy/numpy.cpp | 1 +
38c9e4
 1 file changed, 1 insertion(+)
38c9e4
38c9e4
diff --git a/src/numpy/numpy.cpp b/src/numpy/numpy.cpp
38c9e4
index 8e259bc75..3ae2295e3 100644
38c9e4
--- a/libs/python/src/numpy/numpy.cpp
38c9e4
+++ b/libs/python/src/numpy/numpy.cpp
38c9e4
@@ -19,6 +19,7 @@ static void wrap_import_array()
38c9e4
 static void * wrap_import_array()
38c9e4
 {
38c9e4
   import_array();
38c9e4
+  return NULL;
38c9e4
 }
38c9e4
 #endif
38c9e4