Skip to content

Conversation

@guitargeek
Copy link
Contributor

Backport recent fixes

The `setattr` function requires three arguments, not two.

Forgetting the `gbl` variable for which the attribute should be set
resulted in pretty nonsensical code, which tried to set attributes of
string literals. Maybe this was the result of the nighly failure on
Fedora 42, where no ROOT/cppyy was in the stack trace at all.

The `_PyErr_SetString` clearly told us that the crash happens in the
formatting of the error message of some of the expected exceptions. So
the call to `setattr` that is invalid for two reasons (wrong number of
args, trying to set attribute of immutable string literal) is my best
guess.

```txt
 381/3712 Test root-project#1851: roottest-python-basic-datatype ....................................................................***Failed    7.54 sec
Info in <TUnixSystem::ACLiC>: creating shared library /github/home/ROOT-CI/build/roottest/python/basic/./DataTypes_C.so

-- TEST COMMAND --
cd /github/home/ROOT-CI/build/roottest/python/basic
/usr/sbin/timeout -s USR2 270s /py-venv/ROOT-CI/bin/python3.13 /github/home/ROOT-CI/src/roottest/python/basic/PyROOT_datatypetest.py --fixcling
-- BEGIN TEST OUTPUT --
============================= test session starts ==============================
platform linux -- Python 3.13.9, pytest-9.0.2, pluggy-1.6.0
rootdir: /github/home/ROOT-CI/src
configfile: pyproject.toml
plugins: anyio-4.12.0
collected 24 items

../../../../src/roottest/python/basic/PyROOT_datatypetest.py ........... [ 45%]
....... *** Break *** segmentation violation
 Generating stack trace...
 0x00007f1e372498b7 in _PyErr_SetString + 0x47 from /lib64/libpython3.13.so.1.0
 0x00007f1e370c06da in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e371d37ff in _PyEval_EvalFrameDefault + 0x441f from /lib64/libpython3.13.so.1.0
 0x00007f1e372bf359 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e37320c37 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e371d41b5 in _PyEval_EvalFrameDefault + 0x4dd5 from /lib64/libpython3.13.so.1.0
 0x00007f1e372a88c4 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372f9b49 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e371bdcbc in _PyObject_MakeTpCall + 0x2ac from /lib64/libpython3.13.so.1.0
 0x00007f1e371d955a in _PyEval_EvalFrameDefault + 0xa17a from /lib64/libpython3.13.so.1.0
 0x00007f1e372a88c4 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372f9b49 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e371bdcbc in _PyObject_MakeTpCall + 0x2ac from /lib64/libpython3.13.so.1.0
 0x00007f1e371d955a in _PyEval_EvalFrameDefault + 0xa17a from /lib64/libpython3.13.so.1.0
 0x00007f1e372a88c4 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372f9b49 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e371bdcbc in _PyObject_MakeTpCall + 0x2ac from /lib64/libpython3.13.so.1.0
 0x00007f1e371d955a in _PyEval_EvalFrameDefault + 0xa17a from /lib64/libpython3.13.so.1.0
 0x00007f1e372aa82f in PyEval_EvalCode + 0x9f from /lib64/libpython3.13.so.1.0
 0x00007f1e372e9dec in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372e6f05 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372e3587 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372e31ff in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372e3021 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372e13e7 in Py_RunMain + 0x3f7 from /lib64/libpython3.13.so.1.0
 0x00007f1e3729820b in Py_BytesMain + 0x3b from /lib64/libpython3.13.so.1.0
 0x00007f1e36e90575 in <unknown> from /lib64/libc.so.6
 0x00007f1e36e90628 in __libc_start_main at :? from /lib64/libc.so.6
 0x0000564c4b8a23d5 in _start + 0x25 from /py-venv/ROOT-CI/bin/python3.13
 *** Break *** segmentation violation
 Generating stack trace...
 0x00007f1e372498b7 in _PyErr_SetString + 0x47 from /lib64/libpython3.13.so.1.0
 0x00007f1e370c06da in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e371d37ff in _PyEval_EvalFrameDefault + 0x441f from /lib64/libpython3.13.so.1.0
 0x00007f1e372bf359 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e37320c37 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e371d41b5 in _PyEval_EvalFrameDefault + 0x4dd5 from /lib64/libpython3.13.so.1.0
 0x00007f1e372a88c4 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372f9b49 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e371bdcbc in _PyObject_MakeTpCall + 0x2ac from /lib64/libpython3.13.so.1.0
 0x00007f1e371d955a in _PyEval_EvalFrameDefault + 0xa17a from /lib64/libpython3.13.so.1.0
 0x00007f1e372a88c4 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372f9b49 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e371bdcbc in _PyObject_MakeTpCall + 0x2ac from /lib64/libpython3.13.so.1.0
 0x00007f1e371d955a in _PyEval_EvalFrameDefault + 0xa17a from /lib64/libpython3.13.so.1.0
 0x00007f1e372a88c4 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372f9b49 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e371bdcbc in _PyObject_MakeTpCall + 0x2ac from /lib64/libpython3.13.so.1.0
 0x00007f1e371d955a in _PyEval_EvalFrameDefault + 0xa17a from /lib64/libpython3.13.so.1.0
 0x00007f1e372aa82f in PyEval_EvalCode + 0x9f from /lib64/libpython3.13.so.1.0
 0x00007f1e372e9dec in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372e6f05 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372e3587 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372e31ff in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372e3021 in <unknown> from /lib64/libpython3.13.so.1.0
 0x00007f1e372e13e7 in Py_RunMain + 0x3f7 from /lib64/libpython3.13.so.1.0
 0x00007f1e3729820b in Py_BytesMain + 0x3b from /lib64/libpython3.13.so.1.0
 0x00007f1e36e90575 in <unknown> from /lib64/libc.so.6
 0x00007f1e36e90628 in __libc_start_main at :? from /lib64/libc.so.6
 0x0000564c4b8a23d5 in _start + 0x25 from /py-venv/ROOT-CI/bin/python3.13

-- END TEST OUTPUT --
CMake Error at /github/home/ROOT-CI/build/RootTestDriver.cmake:186 (message):
  got exit code 129 but expected 0

```

(cherry picked from commit e677a75)
This doesn't help the user, and also confuses the CI when testing,
because tutorials can apparently succeed even if they do nothing.

(cherry picked from commit 8617e8b)
Follows up on 45bef34, adding a veto if NumPy is not found. Also,
move vetoes for tutorials when xrootd is not available to the right
place.

(cherry picked from commit 094dda7)
This is not needed for ROOT, because the CPyCppyy API headers are
installed with the other ROOT headers anyway, and ROOT knows where to
find them already.

(cherry picked from commit 251de0f)
Just like for other pdfs that are strictly zero for negative observable
values, the integral for xMin < zero should still evaluate correctly
(compare for example with the RooLandau).

Addresses this forum report:
https://root-forum.cern.ch/t/roofit-pdfs-with-different-domain-in-the-same-model-e-g-gauss-lognormal/64505/3

Little demo that it works now:
```c++
RooRealVar x("x", "x", 0.0, 10.0);
RooRealVar mu("mu", "mu", 1.0);
RooRealVar sigma("sigma", "sigma", 0.5);
RooLognormal logn("logn", "lognormal pdf", x, mu, sigma);

double a = -1.0;
double b = 5.0;

x.setRange("intRange", -1.0, 5.0);

RooAbsReal* integral = logn.createIntegral(x, RooFit::NormSet(x),
                                           RooFit::Range("intRange"));

double result = integral->getVal();

std::cout << "Integral of Lognormal from " << a << " to " << b
          << " = " << result << std::endl;
```

(cherry picked from commit 7ffaf51)
@guitargeek guitargeek self-assigned this Dec 11, 2025
@guitargeek guitargeek changed the title [v638] [v638] Backport of recent Python and RooFit fixes Dec 11, 2025
@github-actions
Copy link

github-actions bot commented Dec 11, 2025

Test Results

    20 files      20 suites   3d 9h 20m 5s ⏱️
 3 710 tests  3 710 ✅ 0 💤 0 ❌
72 649 runs  72 649 ✅ 0 💤 0 ❌

Results for commit 34372594.

♻️ This comment has been updated with latest results.

Similar to f26668d and 6c3a574.

Also, fix a wrong version comparison in the Python comments.

(cherry picked from commit 2429af9)
@guitargeek guitargeek merged commit d9503af into root-project:v6-38-00-patches Dec 11, 2025
26 of 28 checks passed
@guitargeek guitargeek deleted the bp_1 branch December 11, 2025 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant