From 323742cc2db1de1d0fd223d9364948c465f7e85c Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 3 Nov 2022 15:21:57 +0100 Subject: [PATCH 1/2] [Python] Avoid crash during prepare call (#1810) --- bindings/python/src/PyXRootDFileSystem.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bindings/python/src/PyXRootDFileSystem.cc b/bindings/python/src/PyXRootDFileSystem.cc index d53fbd7fc65..ceb2c01f7a6 100644 --- a/bindings/python/src/PyXRootDFileSystem.cc +++ b/bindings/python/src/PyXRootDFileSystem.cc @@ -608,15 +608,15 @@ namespace PyXRootD { static const char *kwlist[] = { "files", "flags", "priority", "timeout", "callback", NULL }; - XrdCl::PrepareFlags::Flags flags; + uint16_t flagval = 0; uint8_t priority = 0; uint16_t timeout = 0; PyObject *pyfiles = NULL, *callback = NULL; PyObject *pyresponse = NULL, *pystatus = NULL; XrdCl::XRootDStatus status; - if ( !PyArg_ParseTupleAndKeywords( args, kwds, "OK|bHO:prepare", - (char**) kwlist, &pyfiles, &flags, &priority, &timeout, &callback ) ) + if ( !PyArg_ParseTupleAndKeywords( args, kwds, "OH|bHO:prepare", + (char**) kwlist, &pyfiles, &flagval, &priority, &timeout, &callback ) ) return NULL; if ( !PyList_Check( pyfiles ) ) { @@ -636,6 +636,9 @@ namespace PyXRootD files.push_back( std::string( file ) ); } + XrdCl::PrepareFlags::Flags flags; + flags = static_cast(flagval); + if ( callback && callback != Py_None ) { XrdCl::ResponseHandler *handler = GetHandler( callback ); if ( !handler ) return NULL; From 3cf9f11b2aa0617144efafa33867a25ab8ea1779 Mon Sep 17 00:00:00 2001 From: Manuel Reis Date: Tue, 25 Oct 2022 14:23:09 +0200 Subject: [PATCH 2/2] [Python] Typo on FileSystem module methods --- bindings/python/src/PyXRootDFileSystem.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/python/src/PyXRootDFileSystem.hh b/bindings/python/src/PyXRootDFileSystem.hh index f884641927e..d3dd393fe3e 100644 --- a/bindings/python/src/PyXRootDFileSystem.hh +++ b/bindings/python/src/PyXRootDFileSystem.hh @@ -124,7 +124,7 @@ namespace PyXRootD { "del_xattr", (PyCFunction) PyXRootD::FileSystem::DelXAttr, METH_VARARGS | METH_KEYWORDS, NULL }, { "list_xattr", - (PyCFunction) PyXRootD::FileSystem::DelXAttr, METH_VARARGS | METH_KEYWORDS, NULL }, + (PyCFunction) PyXRootD::FileSystem::ListXAttr, METH_VARARGS | METH_KEYWORDS, NULL }, { NULL } /* Sentinel */ };