Patch numpy for Python 3 (#1596468)

This commit is contained in:
Jonathan Wakely 2018-07-18 17:20:03 +01:00
parent ae9f023f89
commit 015b3a9f0a
2 changed files with 38 additions and 1 deletions

29
boost-1.66.0-numpy3.patch Normal file
View File

@ -0,0 +1,29 @@
From 0fce0e589353d772ceda4d493b147138406b22fd 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/libs/python/src/numpy/numpy.cpp
+++ b/libs/python/src/numpy/numpy.cpp
@@ -19,6 +19,7 @@ static void wrap_import_array()
static void * wrap_import_array()
{
import_array();
+ return NULL;
}
#endif

View File

@ -36,7 +36,7 @@ Name: boost
Summary: The free peer-reviewed portable C++ source libraries Summary: The free peer-reviewed portable C++ source libraries
Version: 1.66.0 Version: 1.66.0
%global version_enc 1_66_0 %global version_enc 1_66_0
Release: 13%{?dist} Release: 14%{?dist}
License: Boost and MIT and Python License: Boost and MIT and Python
%global toplev_dirname %{name}_%{version_enc} %global toplev_dirname %{name}_%{version_enc}
@ -147,6 +147,10 @@ Patch85: boost-1.66.0-compute.patch
# https://github.com/boostorg/python/pull/186 # https://github.com/boostorg/python/pull/186
Patch86: boost-1.66.0-python37.patch Patch86: boost-1.66.0-python37.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1596468
# https://github.com/boostorg/python/pull/218
Patch87: boost-1.66.0-numpy3.patch
%bcond_with tests %bcond_with tests
%bcond_with docs_generated %bcond_with docs_generated
@ -761,6 +765,7 @@ find ./boost -name '*.hpp' -perm /111 | xargs chmod a-x
%patch84 -p1 %patch84 -p1
%patch85 -p2 %patch85 -p2
%patch86 -p1 %patch86 -p1
%patch87 -p1
%build %build
# Dump the versions being used into the build logs. # Dump the versions being used into the build logs.
@ -1479,6 +1484,9 @@ fi
%{_mandir}/man1/bjam.1* %{_mandir}/man1/bjam.1*
%changelog %changelog
* Wed Jul 18 2018 Jonathan Wakely <jwakely@redhat.com> - 1.66.0-14
- Patch numpy for Python 3 (#1596468)
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.66.0-13 * Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.66.0-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild