public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Mattias Ellert <mattias.ellert@physics.uu.se>
To: git-commits@fedoraproject.org
Subject: [rpms/xrootd] rawhide: Some fixes for the python bindings
Date: Sun, 22 Nov 2026 09:06:24 GMT [thread overview]
Message-ID: <179533838410.1.10026273135086025285.rpms-xrootd-3b44486e91fb@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/xrootd
Branch : rawhide
Commit : 3b44486e91fb8b8923fadffe27fb5a7020027cdc
Author : Mattias Ellert <mattias.ellert@physics.uu.se>
Date : 2026-10-11T13:46:54+02:00
Stats : +254/-21 in 5 file(s)
URL : https://src.fedoraproject.org/rpms/xrootd/c/3b44486e91fb8b8923fadffe27fb5a7020027cdc?branch=rawhide
Log:
Some fixes for the python bindings
---
diff --git a/0001-Python-Fix-parsing-of-enum-arguments-in-python-bindi.patch b/0001-Python-Fix-parsing-of-enum-arguments-in-python-bindi.patch
index 2d11691..d3afd79 100644
--- a/0001-Python-Fix-parsing-of-enum-arguments-in-python-bindi.patch
+++ b/0001-Python-Fix-parsing-of-enum-arguments-in-python-bindi.patch
@@ -1,7 +1,7 @@
From d4005e057943ad73e831b26300151f628ec5fb51 Mon Sep 17 00:00:00 2001
From: Mattias Ellert <mattias.ellert@physics.uu.se>
Date: Sat, 3 Oct 2026 23:51:59 +0200
-Subject: [PATCH 1/2] [Python] Fix parsing of enum arguments in python bindings
+Subject: [PATCH 1/4] [Python] Fix parsing of enum arguments in python bindings
The underlying type of an enum is not mandated by the C++ standard, so
which format character to use when parsing an enum argument in the
@@ -239,5 +239,5 @@ index a21148328..c507e6b4e 100644
if ( callback && callback != Py_None ) {
XrdCl::ResponseHandler *handler = GetHandler<XrdCl::Buffer>( callback );
--
-2.55.0
+2.56.0
diff --git a/0002-Python-Fix-parsing-of-uint64_t-arguments-in-python-b.patch b/0002-Python-Fix-parsing-of-uint64_t-arguments-in-python-b.patch
index 5ed4da5..64cc78c 100644
--- a/0002-Python-Fix-parsing-of-uint64_t-arguments-in-python-b.patch
+++ b/0002-Python-Fix-parsing-of-uint64_t-arguments-in-python-b.patch
@@ -1,7 +1,7 @@
-From c6601f0961f6aedeb9616cc25e27553d2c21f12b Mon Sep 17 00:00:00 2001
+From 94a19d0e7bf3c378c67eb18a6fb51d4428234e82 Mon Sep 17 00:00:00 2001
From: Mattias Ellert <mattias.ellert@physics.uu.se>
Date: Tue, 6 Oct 2026 08:13:49 +0200
-Subject: [PATCH 2/2] [Python] Fix parsing of uint64_t arguments in python
+Subject: [PATCH 2/4] [Python] Fix parsing of uint64_t arguments in python
bindings
Previously the format "k" (unsigned long) was used for parsing
@@ -11,46 +11,70 @@ long long) which is 64 bits wide on both 32 and 64 bit architectures.
This is a backport of the corresponding fix in XRootD 6.
---
- bindings/python/src/Conversions.hh | 8 ++++----
- bindings/python/src/PyXRootDFile.cc | 6 +++---
- 2 files changed, 7 insertions(+), 7 deletions(-)
+ bindings/python/src/Conversions.hh | 25 ++++++++++++++++---------
+ bindings/python/src/PyXRootDFile.cc | 18 +++++++-----------
+ 2 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/bindings/python/src/Conversions.hh b/bindings/python/src/Conversions.hh
-index 5c52ab28e..862fb44ad 100644
+index 5c52ab28e..629bb0a79 100644
--- a/bindings/python/src/Conversions.hh
+++ b/bindings/python/src/Conversions.hh
-@@ -127,9 +127,9 @@ namespace PyXRootD
+@@ -127,9 +127,11 @@ namespace PyXRootD
{
return Py_BuildValue("{sNsNsNsNsN}",
"id", Py_BuildValue("s", info->GetId().c_str()),
- "size", Py_BuildValue("k", info->GetSize()),
-+ "size", Py_BuildValue("K", info->GetSize()),
++ "size", Py_BuildValue("K",
++ static_cast<unsigned long long>(info->GetSize())),
"flags", Py_BuildValue("I", info->GetFlags()),
- "modtime", Py_BuildValue("k", info->GetModTime()),
-+ "modtime", Py_BuildValue("K", info->GetModTime()),
++ "modtime", Py_BuildValue("K",
++ static_cast<unsigned long long>(info->GetModTime())),
"modtimestr", Py_BuildValue("s",
info->GetModTimeAsString().c_str()));
}
-@@ -139,7 +139,7 @@ namespace PyXRootD
+@@ -139,11 +141,15 @@ namespace PyXRootD
{
static PyObject* Convert( XrdCl::StatInfoVFS *info )
{
- return Py_BuildValue( "{sksksksksbsb}",
+- "nodes_rw", info->GetNodesRW(),
+- "nodes_staging", info->GetNodesStaging(),
+- "free_rw", info->GetFreeRW(),
+- "free_staging", info->GetFreeStaging(),
+ return Py_BuildValue( "{sKsKsKsKsbsb}",
- "nodes_rw", info->GetNodesRW(),
- "nodes_staging", info->GetNodesStaging(),
- "free_rw", info->GetFreeRW(),
-@@ -275,7 +275,7 @@ namespace PyXRootD
++ "nodes_rw",
++ static_cast<unsigned long long>(info->GetNodesRW()),
++ "nodes_staging",
++ static_cast<unsigned long long>(info->GetNodesStaging()),
++ "free_rw",
++ static_cast<unsigned long long>(info->GetFreeRW()),
++ "free_staging",
++ static_cast<unsigned long long>(info->GetFreeStaging()),
+ "utilization_rw", info->GetUtilizationRW(),
+ "utilization_staging", info->GetUtilizationStaging() );
+ }
+@@ -275,7 +281,8 @@ namespace PyXRootD
PyList_SET_ITEM( pychunks, i,
Py_BuildValue( "{sNsNsO}",
- "offset", Py_BuildValue( "k", chunk.offset ),
-+ "offset", Py_BuildValue( "K", chunk.offset ),
++ "offset", Py_BuildValue( "K",
++ static_cast<unsigned long long>(chunk.offset) ),
"length", Py_BuildValue( "I", chunk.length ),
"buffer", buffer ) );
Py_DECREF( buffer );
+@@ -323,7 +330,7 @@ namespace PyXRootD
+ key = "size";
+ if(result->HasProperty(key))
+ {
+- uint64_t s;
++ unsigned long long s;
+ result->Get(key, s);
+ kO = Py_BuildValue("s", key);
+ vO = Py_BuildValue("K", s);
diff --git a/bindings/python/src/PyXRootDFile.cc b/bindings/python/src/PyXRootDFile.cc
-index ef0f31d1e..790491776 100644
+index ef0f31d1e..ded9edd3d 100644
--- a/bindings/python/src/PyXRootDFile.cc
+++ b/bindings/python/src/PyXRootDFile.cc
@@ -325,8 +325,8 @@ namespace PyXRootD
@@ -64,7 +88,35 @@ index ef0f31d1e..790491776 100644
unsigned long long tmp_offset = 0;
unsigned int tmp_size = 0, tmp_chunksize = 0;
-@@ -412,7 +412,7 @@ namespace PyXRootD
+@@ -387,8 +387,6 @@ namespace PyXRootD
+ PyObject* File::ReadChunks( File *self, PyObject *args, PyObject *kwds )
+ {
+ static const char *kwlist[] = { "offset", "chunksize", NULL };
+- uint64_t offset = 0;
+- uint32_t chunksize = 0;
+ ChunkIterator *iterator;
+ PyObject *py_offset = NULL, *py_chunksize = NULL;
+
+@@ -397,22 +395,20 @@ namespace PyXRootD
+ if ( !PyArg_ParseTupleAndKeywords( args, kwds, "|OO:readchunks",
+ (char**) kwlist, &py_offset, &py_chunksize ) ) return NULL;
+
+- unsigned long long tmp_offset = 0;
+- unsigned int tmp_chunksize = 1024 * 1024 *2; // 2 MB
++ unsigned long long offset = 0;
++ unsigned int chunksize = 1024 * 1024 *2; // 2 MB
+
+- if ( py_offset && PyObjToUllong( py_offset, &tmp_offset, "offset" ) )
++ if ( py_offset && PyObjToUllong( py_offset, &offset, "offset" ) )
+ return NULL;
+
+- if ( py_chunksize && PyObjToUint( py_chunksize, &tmp_chunksize, "chunksize" ) )
++ if ( py_chunksize && PyObjToUint( py_chunksize, &chunksize, "chunksize" ) )
+ return NULL;
+
+- offset = (uint64_t)tmp_offset;
+- chunksize = (uint32_t)tmp_chunksize;
+ ChunkIteratorType.tp_new = PyType_GenericNew;
if ( PyType_Ready( &ChunkIteratorType ) < 0 ) return NULL;
@@ -74,5 +126,5 @@ index ef0f31d1e..790491776 100644
iterator = (ChunkIterator*)
PyObject_CallObject( (PyObject *) &ChunkIteratorType, args );
--
-2.55.0
+2.56.0
diff --git a/0003-Python-Fix-parsing-of-bool-argument-in-python-bindin.patch b/0003-Python-Fix-parsing-of-bool-argument-in-python-bindin.patch
new file mode 100644
index 0000000..c7e8a1b
--- /dev/null
+++ b/0003-Python-Fix-parsing-of-bool-argument-in-python-bindin.patch
@@ -0,0 +1,27 @@
+From 4afcc26be18c93c6081a7b1fb7e1fd0fd3840b0b Mon Sep 17 00:00:00 2001
+From: Mattias Ellert <mattias.ellert@physics.uu.se>
+Date: Thu, 8 Oct 2026 19:29:25 +0200
+Subject: [PATCH 3/4] [Python] Fix parsing of bool argument in python bindings
+
+Boolean values should use the "b" format. This is a backport of the
+corresponding fix in XRootD 6.
+---
+ bindings/python/src/PyXRootDFileSystem.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/bindings/python/src/PyXRootDFileSystem.cc b/bindings/python/src/PyXRootDFileSystem.cc
+index c507e6b4e..dd346de39 100644
+--- a/bindings/python/src/PyXRootDFileSystem.cc
++++ b/bindings/python/src/PyXRootDFileSystem.cc
+@@ -44,7 +44,7 @@ namespace PyXRootD
+ PyObject *pystatus = NULL;
+ CopyProcess *copyprocess = NULL;
+
+- if ( !PyArg_ParseTupleAndKeywords( args, kwds, "ss|i:copy",
++ if ( !PyArg_ParseTupleAndKeywords( args, kwds, "ss|b:copy",
+ (char**) kwlist, &source, &target, &force ) ) return NULL;
+
+ CopyProcessType.tp_new = PyType_GenericNew;
+--
+2.56.0
+
diff --git a/0004-Python-Update-converter-helper-functions.patch b/0004-Python-Update-converter-helper-functions.patch
new file mode 100644
index 0000000..0e0e72f
--- /dev/null
+++ b/0004-Python-Update-converter-helper-functions.patch
@@ -0,0 +1,147 @@
+From 550c9bfea80abc0db8928ff8638ebad31a7e1181 Mon Sep 17 00:00:00 2001
+From: Mattias Ellert <mattias.ellert@physics.uu.se>
+Date: Fri, 9 Oct 2026 10:52:31 +0200
+Subject: [PATCH 4/4] [Python] Update converter helper functions
+
+The converter for an unsigned long long passed the value through a
+temporary unsigned long, loosing range on 32 bit architectures.
+
+This is a backport of the corresponding fix in XRootD 6.
+---
+ bindings/python/src/Utils.cc | 53 ++++--------------------------------
+ bindings/python/src/Utils.hh | 15 ++--------
+ 2 files changed, 8 insertions(+), 60 deletions(-)
+
+diff --git a/bindings/python/src/Utils.cc b/bindings/python/src/Utils.cc
+index 0d4ba52d8..9d22b3074 100644
+--- a/bindings/python/src/Utils.cc
++++ b/bindings/python/src/Utils.cc
+@@ -55,38 +55,10 @@ namespace PyXRootD
+ }
+
+ //----------------------------------------------------------------------------
+- // Convert PyInt to unsigned long (uint64_t)
+- //----------------------------------------------------------------------------
+- int PyIntToUlong(PyObject *py_val, unsigned long *val, const char *name)
+- {
+- const long tmp = PyLong_AsLong(py_val);
+-
+- if (tmp == -1 && PyErr_Occurred())
+- {
+- if (PyErr_ExceptionMatches(PyExc_OverflowError))
+- PyErr_Format(PyExc_OverflowError, "%s too big for unsigned long", name);
+- return -1;
+- }
+-
+- if (tmp < 0)
+- {
+- PyErr_Format(PyExc_OverflowError,
+- "negative %s cannot be converted to unsigned long", name);
+- return -1;
+- }
+-
+- *val = tmp;
+- return 0;
+- }
+-
+- //----------------------------------------------------------------------------
+- // Convert Python object to unsigned long (uint64_t)
++ // Convert Python object to unsigned long
+ //----------------------------------------------------------------------------
+ int PyObjToUlong(PyObject *py_val, unsigned long *val, const char *name)
+ {
+- if (PyLong_Check(py_val))
+- return PyIntToUlong(py_val, val, name);
+-
+ if (!PyLong_Check(py_val))
+ {
+ PyErr_Format(PyExc_TypeError, "expected integer %s", name);
+@@ -95,7 +67,7 @@ namespace PyXRootD
+
+ const unsigned long tmp = PyLong_AsUnsignedLong(py_val);
+
+- if (PyErr_Occurred())
++ if ((tmp == (unsigned long) -1) && PyErr_Occurred())
+ {
+ if (PyErr_ExceptionMatches(PyExc_OverflowError))
+ PyErr_Format(PyExc_OverflowError, "%s too big for unsigned long", name);
+@@ -132,9 +104,9 @@ namespace PyXRootD
+ //----------------------------------------------------------------------------
+ int PyObjToUshrt(PyObject *py_val, unsigned short int *val, const char *name)
+ {
+- unsigned int tmp;
++ unsigned long tmp;
+
+- if (PyObjToUint(py_val, &tmp, name))
++ if (PyObjToUlong(py_val, &tmp, name))
+ return -1;
+
+ if (tmp > USHRT_MAX)
+@@ -151,29 +123,16 @@ namespace PyXRootD
+ //----------------------------------------------------------------------------
+ // Convert Python object to unsigned long long (uint64_t)
+ //----------------------------------------------------------------------------
+- int PyObjToUllong(PyObject *py_val, unsigned PY_LONG_LONG *val,
++ int PyObjToUllong(PyObject *py_val, unsigned long long *val,
+ const char *name)
+ {
+- if (PyLong_Check(py_val))
+- {
+- unsigned long tmp;
+-
+- if (!PyIntToUlong(py_val, &tmp, name))
+- {
+- *val = tmp;
+- return 0;
+- }
+-
+- return -1;
+- }
+-
+ if (!PyLong_Check(py_val))
+ {
+ PyErr_Format(PyExc_TypeError, "integer argument expected for %s", name);
+ return -1;
+ }
+
+- const unsigned PY_LONG_LONG tmp = PyLong_AsUnsignedLongLong(py_val);
++ const unsigned long long tmp = PyLong_AsUnsignedLongLong(py_val);
+
+ if ((tmp == (unsigned long long) -1) && PyErr_Occurred())
+ {
+diff --git a/bindings/python/src/Utils.hh b/bindings/python/src/Utils.hh
+index c8df4e055..bcf084e56 100644
+--- a/bindings/python/src/Utils.hh
++++ b/bindings/python/src/Utils.hh
+@@ -42,18 +42,7 @@ namespace PyXRootD
+ int InitTypes();
+
+ //----------------------------------------------------------------------------
+- //! Convert PyInt to unsigned long (uint64_t)
+- //!
+- //! @param py_val python object to be converted
+- //! @param val converted value
+- //! @param name name of the object
+- //!
+- //! return 0 if successful, otherwise failed
+- //----------------------------------------------------------------------------
+- int PyIntToUlong(PyObject *py_val, unsigned long *val, const char *name);
+-
+- //----------------------------------------------------------------------------
+- //! Convert Python object to unsigned long (uint64_t)
++ //! Convert Python object to unsigned long
+ //!
+ //! @param py_val python object to be converted
+ //! @param val converted value
+@@ -94,7 +83,7 @@ namespace PyXRootD
+ //!
+ //! return 0 if successful, otherwise failed
+ //----------------------------------------------------------------------------
+- int PyObjToUllong(PyObject *py_val, unsigned PY_LONG_LONG *val, const char *name);
++ int PyObjToUllong(PyObject *py_val, unsigned long long *val, const char *name);
+ }
+
+ #endif /* UTILS_HH_ */
+--
+2.56.0
+
diff --git a/xrootd.spec b/xrootd.spec
index e663ed9..b5166bd 100644
--- a/xrootd.spec
+++ b/xrootd.spec
@@ -14,7 +14,7 @@
Name: xrootd
Epoch: 1
Version: 5.9.8
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Extended ROOT file server
License: LGPL-3.0-or-later AND BSD-2-Clause AND BSD-3-Clause AND curl AND MIT AND Zlib AND Apache-2.0 AND MPL-2.0
URL: https://xrootd.web.cern.ch
@@ -24,6 +24,8 @@ Source1: %{name}-sysusers.conf
# https://github.com/xrootd/xrootd/pull/2971
Patch0: 0001-Python-Fix-parsing-of-enum-arguments-in-python-bindi.patch
Patch1: 0002-Python-Fix-parsing-of-uint64_t-arguments-in-python-b.patch
+Patch2: 0003-Python-Fix-parsing-of-bool-argument-in-python-bindin.patch
+Patch3: 0004-Python-Update-converter-helper-functions.patch
BuildRequires: cmake
BuildRequires: gcc-c++
@@ -274,6 +276,8 @@ This package contains the API documentation of the xrootd libraries.
%patch -P0 -p1
%patch -P1 -p1
+%patch -P2 -p1
+%patch -P3 -p1
# Delete bundled dependencies
rm src/XrdXml/tinyxml/tiny*
@@ -676,6 +680,9 @@ fi
%doc %{_pkgdocdir}
%changelog
+* Sun Oct 11 2026 Mattias Ellert <mattias.ellert@physics.uu.se> - 1:5.9.8-2
+- Some fixes for the python bindings
+
* Tue Oct 06 2026 Mattias Ellert <mattias.ellert@physics.uu.se> - 1:5.9.8-1
- Update to version 5.9.8
next reply other threads:[~2026-11-22 9:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 9:06 Mattias Ellert [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-10-11 12:05 [rpms/xrootd] rawhide: Some fixes for the python bindings Mattias Ellert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179533838410.1.10026273135086025285.rpms-xrootd-3b44486e91fb@fedoraproject.org \
--to=mattias.ellert@physics.uu.se \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox