Writing files with XRootD and Python 3.10 currently fails with:
In [4]: with XRootD.client.File() as file:
...: status, _ = file.open(f"{eos.url}{dest}", OpenFlags.NEW)
...: assert status.ok, status
...: status, _ = file.write(new_data)
...: assert status.ok, status
...:
---------------------------------------------------------------------------
SystemError Traceback (most recent call last)
Input In [4], in <cell line: 1>()
2 status, _ = file.open(f"{eos.url}{dest}", OpenFlags.NEW)
3 assert status.ok, status
----> 4 status, _ = file.write(new_data)
5 assert status.ok, status
File ~/mambaforge/envs/logse-sqlite/lib/python3.10/site-packages/XRootD/client/file.py:190, in File.write(self, buffer, offset, size, timeout, callback)
187 callback = CallbackWrapper(callback, None)
188 return XRootDStatus(self.__file.write(buffer, offset, size, timeout, callback))
--> 190 status, response = self.__file.write(buffer, offset, size, timeout)
191 return XRootDStatus(status), None
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
This PR fixes the issue by defining PY_SSIZE_T_CLEAN
as suggested. Though I'm leaving it as a draft at the moment as I still need to change int
to Py_ssize_t
in the various places to be fully correct.
There is no issue with backwards compatibilty as support for PY_SSIZE_T_CLEAN
was added in Python 2.5
See the release notes and PEP-353 for details.
https://github.com/xrootd/xrootd/pull/1671
(1 file)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Use REPLY-ALL to reply to list
To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1