python3.10 breaking changes

Lee Nelson <[email protected]> Sun, 26 Jun 2022 19:45:05 -0700
Newsgroups gmane.linux.hardware.gpib.general
Message-ID <CAKX4Vk_98bPdkvzXG5LLnUehGR5NzMN8RZ8X34nc3aUBA3WtVA@mail.gmail.com>
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