Re: python3.10 breaking changes

dave penkler <[email protected]> Mon, 27 Jun 2022 07:29:03 +0200
Newsgroups gmane.linux.hardware.gpib.general
Message-ID <CAL=kjP0b-qdBipP+A23Pdbg46fAozDRH=KXpFMnvvPoCzk41eg@mail.gmail.com>
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
>

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