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
20 changes: 20 additions & 0 deletions bindings/pyroot/cppyy/cppyy/test/test_regression.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os, sys, pytest

Check failure on line 1 in bindings/pyroot/cppyy/cppyy/test/test_regression.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E401)

bindings/pyroot/cppyy/cppyy/test/test_regression.py:1:1: E401 Multiple imports on one line
from pytest import mark, raises, skip
from support import setup_make, IS_WINDOWS, ispypy, IS_MAC, IS_MAC_ARM

Check failure on line 3 in bindings/pyroot/cppyy/cppyy/test/test_regression.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F401)

bindings/pyroot/cppyy/cppyy/test/test_regression.py:3:21: F401 `support.setup_make` imported but unused

Check failure on line 3 in bindings/pyroot/cppyy/cppyy/test/test_regression.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (I001)

bindings/pyroot/cppyy/cppyy/test/test_regression.py:1:1: I001 Import block is un-sorted or un-formatted

Expand All @@ -7,7 +7,7 @@
helpout = []

def setup_class(cls):
import cppyy

Check failure on line 10 in bindings/pyroot/cppyy/cppyy/test/test_regression.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F401)

bindings/pyroot/cppyy/cppyy/test/test_regression.py:10:16: F401 `cppyy` imported but unused

if sys.hexversion < 0x30d0000:
def stringpager(text, cls=cls):
Expand All @@ -22,7 +22,7 @@
def test01_kdcraw(self):
"""Doc strings for KDcrawIface (used to crash)."""

import cppyy, pydoc

Check failure on line 25 in bindings/pyroot/cppyy/cppyy/test/test_regression.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (I001)

bindings/pyroot/cppyy/cppyy/test/test_regression.py:25:9: I001 Import block is un-sorted or un-formatted

Check failure on line 25 in bindings/pyroot/cppyy/cppyy/test/test_regression.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E401)

bindings/pyroot/cppyy/cppyy/test/test_regression.py:25:9: E401 Multiple imports on one line

# TODO: run a find for these paths
qtpath = "/usr/include/qt5"
Expand Down Expand Up @@ -54,9 +54,9 @@
if ispypy:
skip('hangs (??) in pypy')

import cppyy, pydoc

Check failure on line 57 in bindings/pyroot/cppyy/cppyy/test/test_regression.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (I001)

bindings/pyroot/cppyy/cppyy/test/test_regression.py:57:9: I001 Import block is un-sorted or un-formatted

Check failure on line 57 in bindings/pyroot/cppyy/cppyy/test/test_regression.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E401)

bindings/pyroot/cppyy/cppyy/test/test_regression.py:57:9: E401 Multiple imports on one line

assert not '__abstractmethods__' in dir(cppyy.gbl.gInterpreter)

Check failure on line 59 in bindings/pyroot/cppyy/cppyy/test/test_regression.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E713)

bindings/pyroot/cppyy/cppyy/test/test_regression.py:59:20: E713 Test for membership should be `not in`
assert '__class__' in dir(cppyy.gbl.gInterpreter)

self.__class__.helpout = []
Expand All @@ -68,7 +68,7 @@

cppyy.cppdef("namespace cppyy_regression_test { void iii() {}; }")

assert not 'iii' in cppyy.gbl.cppyy_regression_test.__dict__

Check failure on line 71 in bindings/pyroot/cppyy/cppyy/test/test_regression.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E713)

bindings/pyroot/cppyy/cppyy/test/test_regression.py:71:20: E713 Test for membership should be `not in`
assert not '__abstractmethods__' in dir(cppyy.gbl.cppyy_regression_test)
assert '__class__' in dir(cppyy.gbl.cppyy_regression_test)
assert 'iii' in dir(cppyy.gbl.cppyy_regression_test)
Expand Down Expand Up @@ -1410,6 +1410,26 @@
assert out == ""
assert err == ""

def test48_variadic_conversion(self):
"""Conversion for a variadic template function"""

import cppyy
cppyy.cppdef("""\
namespace regression_test48 {
template <typename... Ts> void f(std::pair<double, double>) {}
class A {
public:
template <typename... Ts>
void m(std::pair<double, double>) {}
};
}""")

r48 = cppyy.gbl.regression_test48

r48.f((1, 1))
a = r48.A()
a.m((1, 1))

@mark.xfail(run=False, condition=IS_MAC_ARM or IS_WINDOWS == 64, reason="LLVM JIT fails to catch exceptions")
def test49_overloads_with_runtime_errors(self):
"""Regression test for https://github.com/root-project/root/issues/17497
Expand Down
9 changes: 9 additions & 0 deletions core/metacling/src/TCling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4017,6 +4017,9 @@ static std::string AlternateTuple(const char *classname, const cling::LookupHelp
{
// Check if we can produce the tuple
auto iter = tupleContent.fElements.begin() + 1; // Skip the template name (tuple).
if (iter->empty()) { // skip empty template parameter list
iter++;
}
auto theEnd = tupleContent.fElements.end() - 1; // skip the 'stars'.
auto deleter = [](TypeInfo_t *type) {
gInterpreter->TypeInfo_Delete(type);
Expand Down Expand Up @@ -4054,6 +4057,9 @@ static std::string AlternateTuple(const char *classname, const cling::LookupHelp
case ETupleOrdering::kAscending: {
unsigned int nMember = 0;
auto iter = tupleContent.fElements.begin() + 1; // Skip the template name (tuple).
if (iter->empty()) { // skip empty template parameter list
iter++;
}
auto theEnd = tupleContent.fElements.end() - 1; // skip the 'stars'.
auto sep = ':';
while (iter != theEnd) {
Expand All @@ -4068,6 +4074,9 @@ static std::string AlternateTuple(const char *classname, const cling::LookupHelp
case ETupleOrdering::kDescending: {
unsigned int nMember = tupleContent.fElements.size() - 3;
auto iter = tupleContent.fElements.rbegin() + 1; // skip the 'stars'.
if (iter->empty()) { // skip empty template parameter list
iter++;
}
auto theEnd = tupleContent.fElements.rend() - 1; // Skip the template name (tuple).
auto sep = ':';
while (iter != theEnd) {
Expand Down
9 changes: 1 addition & 8 deletions core/metacling/src/TClingMethodInfo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,7 @@ TClingCXXRecMethIter::InstantiateTemplateWithDefaults(const clang::RedeclarableT
llvm::SmallVector<TemplateArgument, 8> defaultTemplateArgs;
for (const NamedDecl *templateParm: *templateParms) {
if (templateParm->isTemplateParameterPack()) {
// This would inject an emprt parameter pack, which is a good default.
// But for cases where instantiation fails, this hits bug in unloading
// of the failed instantiation, causing a missing symbol in subsequent
// transactions where a Decl instantiated by the failed instatiation
// is not re-emitted. So for now just give up default-instantiating
// templates with parameter packs, even if this is simply a work-around.
//defaultTemplateArgs.emplace_back(ArrayRef<TemplateArgument>{}); // empty pack.
return nullptr;
defaultTemplateArgs.emplace_back(ArrayRef<TemplateArgument>{}); // empty pack.
} else if (auto TTP = dyn_cast<TemplateTypeParmDecl>(templateParm)) {
if (!TTP->hasDefaultArgument())
return nullptr;
Expand Down
8 changes: 3 additions & 5 deletions core/metacling/test/TClingMethodInfoTests.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -456,17 +456,15 @@ namespace Templates {
EXPECT_EQ(names.count("Nc"), 0);
EXPECT_EQ(names.count("Nd"), 0);

//[1]: See comment in TClingCXXRecMethIter::InstantiateTemplateWithDefaults()
// handling parameter packs.
EXPECT_EQ(names.count("Ya<int>"), 1);
//EXPECT_EQ(names.count("Yb"), 1); //[1]
EXPECT_EQ(names.count("Yb<>"), 1);
EXPECT_EQ(names.count("Yc<12>"), 1);
EXPECT_EQ(names.count("Yd1<Templates::TypeArg>"), 1);
EXPECT_EQ(names.count("Yd2<Templates::TemplateArg>"), 1);
EXPECT_EQ(names.count("Ye<int>"), 1);
EXPECT_EQ(names.count("Yf<int>"), 1);
//EXPECT_EQ(names.count("Yg<int>"), 1); //[1]
//EXPECT_EQ(names.count("Yh<int, int>"), 1); //[1]
EXPECT_EQ(names.count("Yg<int>"), 1);
EXPECT_EQ(names.count("Yh<int, int>"), 1);

// These do a lookup / overload set, and can materialize functions (like Yb)
// that the enumeration above failed to catch; see overriding
Expand Down
6 changes: 6 additions & 0 deletions core/metacling/test/TClingTests.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -435,3 +435,9 @@ TEST_F(TClingTests, UndeclaredIdentifierCrash)
diagRAII.requiredDiag(kError, "cling", expectedError, false);
gInterpreter->ProcessLine("for(i=0; i < 0;); // the second usage of `i` was enough to get a segfault");
}

TEST_F(TClingTests, TupleEmpty)
{
auto cl = TClass::GetClass("tuple<>");
EXPECT_TRUE(cl);
}
7 changes: 6 additions & 1 deletion tree/dataframe/inc/ROOT/RDF/RLazyDSImpl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ class RLazyDS final : public ROOT::RDF::RDataSource {
return {};
}

size_t GetEntriesNumber() { return std::get<0>(fColumns)->size(); }
size_t GetEntriesNumber()
{
if constexpr (sizeof...(ColumnTypes) > 0)
return std::get<0>(fColumns)->size();
return 0;
}
template <std::size_t... S>
void SetEntryHelper(unsigned int slot, ULong64_t entry, std::index_sequence<S...>)
{
Expand Down
7 changes: 7 additions & 0 deletions tree/dataframe/test/dataframe_cache.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
using namespace ROOT::RDF;
using namespace ROOT::VecOps;

TEST(Cache, Empty)
{
ROOT::RDataFrame df(5);
auto cached = df.Cache<>({});
EXPECT_EQ(*cached.Count(), 0);
}

TEST(Cache, FundType)
{
ROOT::RDataFrame tdf(5);
Expand Down
8 changes: 8 additions & 0 deletions tree/dataframe/test/datasource_lazy.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ TEST(RLazyDS, Constructor)
}
}

TEST(RLazyDS, Empty)
{
RLazyDS<> lazy;
for (auto &&range : lazy.GetEntryRanges()) {
EXPECT_EQ(range.first, 0);
EXPECT_EQ(range.second, 0);
}
}

TEST(RLazyDS, RangesOneSlot)
{
Expand Down
Loading