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
21 changes: 9 additions & 12 deletions bindings/pyroot/cppyy/CPyCppyy/src/Converters.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <algorithm>
#include <array>
#include <locale> // for wstring_convert
#include <regex>
#include <utility>
#include <sstream>
#if __cplusplus > 201402L
Expand Down Expand Up @@ -57,8 +56,6 @@ namespace CPyCppyy {
extern PyObject* gNullPtrObject;
extern PyObject* gDefaultObject;

// regular expression for matching function pointer
static std::regex s_fnptr("\\(:*\\*&*\\)");
}

#if PY_VERSION_HEX < 0x03000000
Expand Down Expand Up @@ -3307,15 +3304,15 @@ CPyCppyy::Converter* CPyCppyy::CreateConverter(const std::string& fullType, cdim
// -- CLING WORKAROUND
result = selectInstanceCnv(klass, cpd, dims, isConst, control);
}
} else {
std::smatch sm;
if (std::regex_search(resolvedType, sm, s_fnptr)) {
// this is a function pointer
auto pos1 = sm.position(0);
auto pos2 = resolvedType.rfind(')');
result = new FunctionPointerConverter(
resolvedType.substr(0, pos1), resolvedType.substr(pos1+sm.length(), pos2-1));
}
} else if (resolvedType.find("(*)") != std::string::npos ||
(resolvedType.find("::*)") != std::string::npos)) {
// this is a function pointer
// TODO: find better way of finding the type
auto pos1 = resolvedType.find('(');
auto pos2 = resolvedType.find("*)");
auto pos3 = resolvedType.rfind(')');
result = new FunctionPointerConverter(
resolvedType.substr(0, pos1), resolvedType.substr(pos2+2, pos3-pos2-1));
}

if (!result && cpd == "&&") {
Expand Down
6 changes: 1 addition & 5 deletions tmva/tmva/test/rbdt_xgboost.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# XGBoost has to be imported before ROOT to avoid crashes because of clashing
# std::regexp symbols that are exported by cppyy.
# See also: https://github.com/wlav/cppyy/issues/227
import xgboost

import unittest
import ROOT
import numpy as np
import json
import xgboost

np.random.seed(1234)

Expand Down
Loading