You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Several things have changed (bugs fixed) in ctypesgen over the last few years. Are you running the same version of ctypesgen in python 2 as you are running in python 3?
ctypesgen once had an override of the POINTER type factory (and still has with --no-embed-preamble) that destroys type checks. See also #86 (comment) and #26.
It may be related to that. My guess is that the xyz instance created and the xyz type used in the argtypes might actually originate from two separate, duplicate definitions, so they're formally recognized as different.
Use -m / --link-modules to avoid that.
Here's the Python call and exception
attr = xyz()
myfunc(a, b, c, pointer(attr))
Above code runs fine on Python 2, but throws below exception with Python 3.7.4
ERR: argument 4: <class 'TypeError'>: expected LP_xyz instance instead of LP_xyz
C function prototype (also used to generate ctypes) is: myfunc(int a, int b, int c, xyz *p);
The text was updated successfully, but these errors were encountered: