This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ctypes.Structure formal parameter dies given tuple
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: theller Nosy List: tgbishop, theller
Priority: normal Keywords:

Created on 2007-02-03 14:05 by tgbishop, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg31171 - (view) Author: Gary Bishop (tgbishop) Date: 2007-02-03 14:05
With a structure like:

class CvRect(ctypes.Structure):
    _fields_ = [("x", ctypes.c_int),
                ("y", ctypes.c_int),
                ("width", ctypes.c_int),
                ("height", ctypes.c_int)]

and a foreign function like:

cvSetImageROI = _cxDLL.cvSetImageROI
cvSetImageROI.restype = None # void
cvSetImageROI.argtypes = [
    ctypes.c_void_p, # IplImage* image
    CvRect # CvRect rect
    ]

The call

cvSetImageROI(img, CvRect(1,2,3,4))

works fine but the mistaken call:

cvSetImageROI(img, (1,2,3,4))

Produces the "Send Error Report" dialog from Windows.

Other erroneous arguments produce a message about correct argument type but the tuple triggers some other behavior.
msg31172 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2007-03-09 20:50
Fixed in rev. 54248 (trunk) and rev. 54249 (release25-maint).

Thanks for the report.
History
Date User Action Args
2022-04-11 14:56:22adminsetgithub: 44542
2007-02-03 14:05:22tgbishopcreate