PKGBUILDs/extra/boost/add-missing-return-statement-in-numpy-import.patch
2018-07-12 00:36:29 +00:00

29 lines
1,000 B
Diff

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