[ python-Bugs-1651235 ] ctypes.Structure formal parameter dies given tuple

SourceForge.net noreply at sourceforge.net
Sat Feb 3 15:05:22 CET 2007


Bugs item #1651235, was opened at 2007-02-03 14:05
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1651235&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Gary Bishop (tgbishop)
Assigned to: Nobody/Anonymous (nobody)
Summary: ctypes.Structure formal parameter dies given tuple

Initial Comment:
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.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1651235&group_id=5470


More information about the Python-bugs-list mailing list