2021-06-29 11:56:35 |
zdohnal |
description |
Hi,
we have a report in Fedora rawhide[1] (), where Python3.10 is already introduced, and hpfax crashes there with SystemError:
Truncated backtrace:
device.py:558:probeDevices:SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
Traceback (most recent call last):
File "/usr/lib/cups/backend/hpfax", line 151, in <module>
probed_devices = device.probeDevices(['usb', 'par'], filter={'fax-type': (operator.gt, 0)})
File "/usr/share/hplip/base/device.py", line 558, in probeDevices
result_code, data = hpmudext.probe_devices(bn)
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
The change which the message mentions happened in Python3.10[2]. It is based on PEP 353[3], which forbids int as a sequence indice, and introduces Py_ssize_t indices (most times 'typedef'ed ssize_t from glibc).
The patch defines the mentioned macro in specific source files, and adds range checks for numeric variables coming from PyArg_ParseTuple(). It is because the length variable coming from the function is of Py_ssize_t, which is basically long int, and the hpmud functions uses int, so the value must be checked and adjusted in case it is bigger/smaller than INT_MAX/INT_MIN.
Would you mind merging the patch?
Thank you in advance,
Zdenek
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1976465
[2] https://docs.python.org/3.10/whatsnew/3.10.html#id2
[3] https://www.python.org/dev/peps/pep-0353/ |
Hi,
we have a report in Fedora rawhide[1], where Python3.10 is already introduced, and hpfax crashes there with SystemError:
Truncated backtrace:
device.py:558:probeDevices:SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
Traceback (most recent call last):
File "/usr/lib/cups/backend/hpfax", line 151, in <module>
probed_devices = device.probeDevices(['usb', 'par'], filter={'fax-type': (operator.gt, 0)})
File "/usr/share/hplip/base/device.py", line 558, in probeDevices
result_code, data = hpmudext.probe_devices(bn)
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
The change which the message mentions happened in Python3.10[2]. It is based on PEP 353[3], which forbids int as a sequence indice, and introduces Py_ssize_t indices (most times 'typedef'ed ssize_t from glibc).
The patch defines the mentioned macro in specific source files, and adds range checks for numeric variables coming from PyArg_ParseTuple(). It is because the length variable coming from the function is of Py_ssize_t, which is basically long int, and the hpmud functions uses int, so the value must be checked and adjusted in case it is bigger/smaller than INT_MAX/INT_MIN.
Would you mind merging the patch?
Thank you in advance,
Zdenek
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1976465
[2] https://docs.python.org/3.10/whatsnew/3.10.html#id2
[3] https://www.python.org/dev/peps/pep-0353/ |
|