Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.10 PY_SSIZE_T_CLEAN macro SystemError #478

Open
snowsquizy opened this issue Apr 22, 2022 · 0 comments
Open

Python 3.10 PY_SSIZE_T_CLEAN macro SystemError #478

snowsquizy opened this issue Apr 22, 2022 · 0 comments

Comments

@snowsquizy
Copy link

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant