IanHarvey / bluepy

Python interface to Bluetooth LE on Linux
Other
1.58k stars 490 forks source link

Python 3.10 PY_SSIZE_T_CLEAN macro SystemError #478

Open snowsquizy opened 2 years ago

snowsquizy commented 2 years ago

Currently utlising Bluepy 1.3.0 to communicate with Bluetooth LE device to retrieve fitness data.

The following is the error displayed and looking through Python 3.10 release documentation


File "/home/andrew/Software/MiBand2/./example.py", line 31, in band.authenticate() File "/home/andrew/Software/MiBand2/base.py", line 322, in authenticate self._req_rdn() File "/home/andrew/Software/MiBand2/base.py", line 209, in _req_rdn self.waitForNotifications(self.timeout) File "/home/andrew/.local/lib/python3.10/site-packages/bluepy/btle.py", line 560, in waitForNotifications resp = self._getResp(['ntfy','ind'], timeout) File "/home/andrew/.local/lib/python3.10/site-packages/bluepy/btle.py", line 416, in _getResp self.delegate.handleNotification(hnd, data) File "/home/andrew/Software/MiBand2/base.py", line 34, in handleNotification self.device._send_enc_rdn(random_nr) File "/home/andrew/Software/MiBand2/base.py", line 213, in _send_enc_rdn cmd = self._send_enc_key + self._encrypt(data) File "/home/andrew/Software/MiBand2/base.py", line 198, in _encrypt aes = AES.new(self._KEY, AES.MODE_ECB) File "/home/andrew/.local/lib/python3.10/site-packages/Crypto/Cipher/AES.py", line 95, in new return AESCipher(key, *args, kwargs) File "/home/andrew/.local/lib/python3.10/site-packages/Crypto/Cipher/AES.py", line 59, in init blockalgo.BlockAlgo.init(self, _AES, key, *args, *kwargs) File "/home/andrew/.local/lib/python3.10/site-packages/Crypto/Cipher/blockalgo.py", line 141, in init self._cipher = factory.new(key, args, kwargs) SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats


Looking through Python 3.10 release documentation and this is the statement regarding PY_SSIZE_T_CLEAN

Porting to Python 3.10 The PY_SSIZE_T_CLEAN macro must now be defined to use PyArg_ParseTuple() and Py_BuildValue() formats which use #: es#, et#, s#, u#, y#, z#, U# and Z#. See Parsing arguments and building values and the PEP 353. (Contributed by Victor Stinner in bpo-40943.)