Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix errors with GCC 6.1.1 and Python 3.5
ROOT won't compile because of changes in the Python API together with
GCC 6.1 release. The code changes fixes the issues on my machine running
Arch Linux (except for an error in Python 3.5 numpy/__multiarray_api.h)
  • Loading branch information
a2wagner committed May 20, 2016
commit e42e2bd30ed875a89c1910c524df08e66572c306
5 changes: 5 additions & 0 deletions tmva/pymva/src/MethodPyAdaBoost.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>

#if PY_VERSION_HEX >= 0x03000000
#define PyString_FromString PyBytes_FromString
#define PyString_AsString PyBytes_AsString
#endif

#include "TMath.h"
#include "Riostream.h"
#include "TMatrix.h"
Expand Down
5 changes: 5 additions & 0 deletions tmva/pymva/src/MethodPyGTB.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>

#if PY_VERSION_HEX >= 0x03000000
#define PyString_FromString PyBytes_FromString
#define PyString_AsString PyBytes_AsString
#endif

#include "TMath.h"
#include "Riostream.h"
#include "TMatrix.h"
Expand Down
5 changes: 5 additions & 0 deletions tmva/pymva/src/MethodPyRandomForest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>

#if PY_VERSION_HEX >= 0x03000000
#define PyString_FromString PyBytes_FromString
#define PyString_AsString PyBytes_AsString
#endif

#include "TMath.h"
#include "Riostream.h"
#include "TMatrix.h"
Expand Down
12 changes: 12 additions & 0 deletions tmva/pymva/src/PyMethodBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>

#if PY_VERSION_HEX >= 0x03000000
#define PyString_FromString PyBytes_FromString
#endif


using namespace TMVA;

Expand Down Expand Up @@ -133,7 +137,15 @@ void PyMethodBase::PyFinalize()
}
void PyMethodBase::PySetProgramName(TString name)
{
#if PY_VERSION_HEX >= 0x03000000
const char* char_name = const_cast<char *>(name.Data());
const size_t size = strlen(char_name)+1;
wchar_t wchar_name[size];
mbstowcs(wchar_name, char_name, size);
Py_SetProgramName(wchar_name);
#else
Py_SetProgramName(const_cast<char *>(name.Data()));
#endif
}
//_______________________________________________________________________
TString PyMethodBase::Py_GetProgramName()
Expand Down