python-mercuryapi icon indicating copy to clipboard operation
python-mercuryapi copied to clipboard

SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

Open scottlinuxden opened this issue 2 years ago • 1 comments

Using Python 3.10.4 within python-mercuryapi and when you make a call to write() you get the error in the subject. I am using an M6e micro ThingMagic USB Pro reader. This appears to be a python 3.10 specific requirement or issue which has introduced this similar error in other python extensions.

scottlinuxden avatar Jul 07 '22 22:07 scottlinuxden

Fixed the issue in this thread by performing the followin in file mercury.c

added the following line before #include <Python.h>: #define PY_SSIZE_T_CLEAN

change the line "int data_len;" in Reader_write function to: Py_SSIZE_t data_len;

ran make and install again to rebuild and issue no longer exists

I did not check any other functions with keywords and potential issue since I was only using read/write.

I did not submit a pull request. I do think it would be beneficial to put this change in this package since 3.10 is the latest release of python and this API will be broke at least for writing to a tag.

scottlinuxden avatar Jul 07 '22 23:07 scottlinuxden

I just re-invented this fix. Should have checked the existing issues better I suppose. Google didn't find it for me. I however did submit a pull request. Shared credit? =)

BathroomEpiphanies avatar Jan 23 '24 19:01 BathroomEpiphanies

Fixed via #146

gotthardp avatar Jan 23 '24 20:01 gotthardp