root/root-Avoid-OverflowError-from-RDF-pythonization.patch
2025-08-28 02:21:32 +02:00

41 lines
2.1 KiB
Diff

From c3a9293a08fecb288cdd09b399c9c2808923e617 Mon Sep 17 00:00:00 2001
From: Mattias Ellert <mattias.ellert@physics.uu.se>
Date: Wed, 27 Aug 2025 17:09:12 +0200
Subject: [PATCH] Avoid OverflowError from RDF pythonization
Fixes test failures on 32 bit intel ix86.
The following tests FAILED:
62 - pyunittests-bindings-pyroot-pythonizations-pyroot-pyz-rdataframe-makenumpy (Failed) python python_runtime_deps
1257 - tutorial-analysis-dataframe-df032_RDFFromNumpy-py (Failed) python_runtime_deps tutorial
1259/1470 Test #1257: tutorial-analysis-dataframe-df032_RDFFromNumpy-py .............................................***Failed 1.14 sec
Traceback (most recent call last):
File ".../tutorials/analysis/dataframe/df032_RDFFromNumpy.py", line 23, in <module>
df = ROOT.RDF.FromNumpy({'x': x, 'y': y})
File ".../redhat-linux-build/lib/ROOT/_facade.py", line 349, in MakeNumpyDataFrameCopy
return _MakeNumpyDataFrame(np_dict)
File ".../redhat-linux-build/lib/ROOT/_pythonization/_rdataframe.py", line 601, in _MakeNumpyDataFrame
return ROOT.Internal.RDF.MakeRVecDataFrame(ROOT.__ROOT_Internal.MakePyDeleter(key), *args)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
OverflowError: Python int too large to convert to C long
---
.../pythonizations/python/ROOT/_pythonization/_rdataframe.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_rdataframe.py b/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_rdataframe.py
index d5cade59805..f9bb2771a73 100644
--- a/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_rdataframe.py
+++ b/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_rdataframe.py
@@ -584,7 +584,7 @@ def _MakeNumpyDataFrame(np_dict):
namespace __ROOT_Internal {
- inline std::function<void()> MakePyDeleter(std::intptr_t ptr) {
+ inline std::function<void()> MakePyDeleter(std::uintptr_t ptr) {
PyObject *obj = reinterpret_cast<PyObject*>(ptr);
Py_INCREF(obj);
return [obj](){ Py_DECREF(obj); };
--
2.51.0