Skip to content

Commit

Permalink
Merge pull request #725 from karthikr-vti/main
Browse files Browse the repository at this point in the history
Types  corrected as per  VISA 7.2 spec(visa.h)
  • Loading branch information
MatthieuDartiailh committed Jan 27, 2023
2 parents c76286f + ba7a8c9 commit 67744e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
PyVISA Changelog
================

1.14.0 (unreleased)
-------------------
- fix ctypes truncated pointers on 64-bit for ViBusAddress, ViBusSize, ViAttrState PR # 725

1.13.0 (22-12-2022)
-------------------

Expand Down
8 changes: 5 additions & 3 deletions pyvisa/ctwrapper/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"""
import ctypes as _ctypes
import sys

from .cthelper import FUNCTYPE

Expand Down Expand Up @@ -104,15 +105,16 @@ def from_param(cls, obj):
# Part Two: Type Assignments for VISA only, see spec table 3.1.2. The
# difference to the above is of no significance in Python, so I use it here
# only for easier synchronisation with the spec.
is_64bit = sys.maxsize > 2**32

ViAccessMode, ViPAccessMode = _type_pair(ViUInt32)
ViBusAddress, ViPBusAddress = _type_pair(ViUInt32)
ViBusAddress, ViPBusAddress = _type_pair(ViUInt64) if is_64bit else _type_pair(ViUInt32)
ViBusAddress64, ViPBusAddress64 = _type_pair(ViUInt64)

ViBusSize = ViUInt32
ViBusSize = ViUInt64 if is_64bit else ViUInt32
ViBusSize64 = ViUInt64

ViAttrState, ViPAttrState = _type_pair(ViUInt32)
ViAttrState, ViPAttrState = _type_pair(ViUInt64) if is_64bit else _type_pair(ViUInt32)

# The following is weird, taken from news:zn2ek2w2.fsf@python.net
ViVAList = _ctypes.POINTER(_ctypes.c_char)
Expand Down

0 comments on commit 67744e5

Please sign in to comment.