Re: python3.10 breaking changes

Lee Nelson <[email protected]> Sun, 26 Jun 2022 22:53:21 -0700
Newsgroups gmane.linux.hardware.gpib.general
Message-ID <CAKX4Vk-a8fEzeSNhzf1YPxbiXNu2go2zCtFoGPzakKJ6nkb+1g@mail.gmail.com>
Oi!  This explains why it seemed to suddenly appear even though I had been
using 3.10 all along.  In an attempt to solve another problem, I switched
from svn to the tarball.

On Sun, Jun 26, 2022 at 10:29 PM dave penkler <[email protected]> wrote:

> The patch to define the PY_SSIZE_T_CLEAN macro from mika was added in
> r1990 so the svn should be OK.
>
> On Mon, 27 Jun 2022 at 05:11, Lee Nelson <[email protected]> wrote:
>
>> There seems to be a breaking change introduced in Python3.10:
>> https://docs.python.org/3.10/whatsnew/3.10.html#id2
>> https://peps.python.org/pep-0353/
>>
>> It appears to be in gpibinter.c and results in an error like this:
>> 2022-06-26 19:03:45,730 - pyvisa - DEBUG - GPIB0::5::INSTR - opening ...
>>
>>
>> 2022-06-26 19:03:45,735 - pyvisa - DEBUG - GPIB0::5::INSTR - is open with
>> session 1840975
>>
>> 2022-06-26 19:03:45,735 - pyvisa - DEBUG - GPIB.write b'*IDN?\r\n'
>>
>>
>> Traceback (most recent call last):
>>
>>
>>   File "/home/lnelson/test_gpib.py", line 6, in <module>
>>
>>
>>     my_instrument.query("*IDN?")
>>
>>
>>   File
>> "/usr/local/lib/python3.10/dist-packages/pyvisa/resources/messagebased.py",
>> line 642, in query
>>
>>     self.write(message)
>>
>>
>>   File
>> "/usr/local/lib/python3.10/dist-packages/pyvisa/resources/messagebased.py",
>> line 197, in write
>>
>>     count = self.write_raw(message.encode(enco))
>>
>>
>>   File
>> "/usr/local/lib/python3.10/dist-packages/pyvisa/resources/messagebased.py",
>> line 157, in write_raw
>>
>>     return self.visalib.write(self.session, message)[0]
>>
>>
>>   File "/usr/local/lib/python3.10/dist-packages/pyvisa_py/highlevel.py",
>> line 543, in write
>>
>>     written, status_code = self.sessions[session].write(data)
>>
>>
>>   File "/usr/local/lib/python3.10/dist-packages/pyvisa_py/gpib.py", line
>> 401, in write
>>
>>     ifc.write(data)
>>   File "/usr/local/lib/python3.10/dist-packages/Gpib.py", line 53, in
>> write
>>     gpib.write(self.id, str)
>> SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
>> 2022-06-26 19:03:45,878 - pyvisa - DEBUG - Closing ResourceManager
>> (session: 7325318)
>> 2022-06-26 19:03:45,878 - pyvisa - DEBUG - GPIB0::5::INSTR - closing
>> 2022-06-26 19:03:45,879 - pyvisa - DEBUG - GPIB0::5::INSTR - is closed
>>
>> It didn't look like this is mentioned elsewhere on the list, so I thought
>> I'd bring it up.
>>
>> _______________________________________________
>> Linux-gpib-general mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/linux-gpib-general
>>
>

-- 
https://keybase.io/nelsonov

_______________________________________________
Linux-gpib-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-gpib-general