root icon indicating copy to clipboard operation
root copied to clipboard

RDatasetSpec is not throwing the correct error when the begin entry > end entry in Python

Open ikabadzhov opened this issue 3 years ago • 0 comments

This was spotted by @vepadulano. As the title suggests: RDatasetSpec is not throwing the correct error when the begin entry > end entry in Python.

Minimal repro:

>>> import ROOT
>>> ds2 = ROOT.RDF.Experimental.RDatasetSpec("tree", "z.root", (10, 7))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: none of the 5 overloaded methods succeeded. Full details:
  RDatasetSpec::RDatasetSpec(ROOT::RDF::Experimental::RDatasetSpec&&) =>
    TypeError: takes at most 1 arguments (3 given)
  RDatasetSpec::RDatasetSpec(const string& treeName, const vector<string>& fileNameGlobs, const ROOT::RDF::Experimental::RDatasetSpec::REntryRange& entryRange = {}) =>
    TypeError: could not convert argument 2
  RDatasetSpec::RDatasetSpec(const vector<pair<string,string> >& treeAndFileNameGlobs, const ROOT::RDF::Experimental::RDatasetSpec::REntryRange& entryRange = {}) =>
    TypeError: takes at most 2 arguments (3 given)
  RDatasetSpec::RDatasetSpec(const ROOT::RDF::Experimental::RDatasetSpec&) =>
    TypeError: takes at most 1 arguments (3 given)
  RDatasetSpec::RDatasetSpec(const string& treeName, const string& fileNameGlob, const ROOT::RDF::Experimental::RDatasetSpec::REntryRange& entryRange = {}) =>
    TypeError: could not convert argument 3

This is instead supposed to trigger:

RDatasetSpec::REntryRange::REntryRange(Long64_t begin, Long64_t end) : fBegin(begin), fEnd(end)
{
   if (fBegin > fEnd)
      throw std::logic_error("The starting entry cannot be larger than the ending entry in the "
                             "creation of a dataset specification.");
}

P.S. very interesting that an overload is not recognized depending on the same basic types.

ikabadzhov avatar Jul 26 '22 08:07 ikabadzhov