Writing files with XRootD and Python 3.10 currently fails with: ```python 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](https://docs.python.org/release/2.5/whatsnew/pep-353.html) See [the release notes](https://docs.python.org/3/whatsnew/3.10.html#id2) and [PEP-353](https://peps.python.org/pep-0353/) for details. You can view, comment on, or merge this pull request online at: https://github.com/xrootd/xrootd/pull/1671 -- Commit Summary -- * Fix Python 3.10+ issues from PY_SSIZE_T_CLEAN not being set -- File Changes -- M bindings/python/src/PyXRootD.hh (1) -- Patch Links -- https://github.com/xrootd/xrootd/pull/1671.patch https://github.com/xrootd/xrootd/pull/1671.diff -- Reply to this email directly or view it on GitHub: https://github.com/xrootd/xrootd/pull/1671 You are receiving this because you are subscribed to this thread. Message ID: <[log in to unmask]> ######################################################################## 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