Skip to content
Merged
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
17 changes: 13 additions & 4 deletions bindings/pyroot/cppyy/CPyCppyy/src/CPPOverload.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1072,10 +1072,19 @@ void CPyCppyy::CPPOverload::Set(const std::string& name, std::vector<PyCallable*
if (name == "__init__")
fMethodInfo->fFlags |= (CallContext::kIsCreator | CallContext::kIsConstructor);

// special case, in heuristics mode also tag *Clone* methods as creators
if (CallContext::sMemoryPolicy == CallContext::kUseHeuristics && \
name.find("Clone") != std::string::npos)
fMethodInfo->fFlags |= CallContext::kIsCreator;
// special case, in heuristics mode also tag *Clone* methods as creators. Only
// check that Clone is present in the method name, not in the template argument
// list.
if (CallContext::sMemoryPolicy == CallContext::kUseHeuristics) {
std::string_view name_maybe_template = name;
auto begin_template = name_maybe_template.find_first_of('<');
if (begin_template <= name_maybe_template.size()) {
name_maybe_template = name_maybe_template.substr(0, begin_template);
}
if (name_maybe_template.find("Clone") != std::string_view::npos) {
fMethodInfo->fFlags |= CallContext::kIsCreator;
}
}

#if PY_VERSION_HEX >= 0x03080000
fVectorCall = (vectorcallfunc)mp_vectorcall;
Expand Down
Loading