[Ironpython-users] ctypes module in version 2.7.2 can't create Union values

Dino Viehland dinov at microsoft.com
Fri Apr 20 23:18:36 CEST 2012


I'd suggest running w/ -X:ExceptionDetail and sending back the stack trace that you 
get as that'll tell us where the exception is coming from.

> -----Original Message-----
> From: ironpython-users-bounces+dinov=microsoft.com at python.org
> [mailto:ironpython-users-bounces+dinov=microsoft.com at python.org] On
> Behalf Of mva at sysfault.org
> Sent: Friday, April 20, 2012 6:46 AM
> To: ironpython-users at python.org
> Subject: [Ironpython-users] ctypes module in version 2.7.2 can't create Union
> values
> 
> Dear all,
> 
> on a 64-bit Windows 7 machine (other platforms untested), I find myself unable
> to create a ctypes.Union-based class wrapper for a C type.
> Regardless of what kind of Union I create, it always ends up with a "object
> reference not set to an instance of an object" error from .NET. Find below a
> brief command line example including the necessary .NET and IronPython
> information.
> 
> IronPython 2.7.2.1 (2.7.0.40) on .NET 4.0.30319.261 (32-bit) Type "help",
> "copyright", "credits" or "license" for more information.
> >>> from ctypes import *
> >>> class foo(Union):
> ...     _fields_ = [("t", c_uint), ("b", c_float)]
> ...
> >>> bar = foo()
> >>> bar.t = 1
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> SystemError: Object reference not set to an instance of an object.
> 
> I'm not subscribed to this list, in case you require more information please keep
> me in CC.
> 
> Regards
> Marcus
> 
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> http://mail.python.org/mailman/listinfo/ironpython-users
> 
> 





More information about the Ironpython-users mailing list