[IronPython] Crash

Harri Vartiainen harri.vartiainen at iki.fi
Sat Mar 8 01:08:46 CET 2008


 I'm testing inside the interactive shell, there are no threads
created by me but I think the DLL I am using uses threads.

 I think the this problem is originated from my own error, when I
defined the callback function with no return value (it is expecting
Int32). When return value is defined it runs fine.  The exception is
raised after the callback function has been executed first time by
library.

Here's the output with -X:ExceptionDetail and no return value defined
inside the callback function:

Unhandled exception:
Cannot convert NoneType() to Int32
   at IronPython.Runtime.Converter.ConvertToInt32(Object value)
   at System.Int32(Int32, Double, IntPtr, Int32)##162(Object , Int32 , Double ,
IntPtr , Int32 )
TypeError: Cannot convert NoneType() to Int32

Unhandled Exception: IronPython.Runtime.Exceptions.ArgumentTypeException: Cannot
 convert NoneType() to Int32
   at IronPython.Runtime.Converter.ConvertToInt32(Object value)
   at System.Int32(Int32, Double, IntPtr, Int32)##162(Object , Int32 , Double ,
IntPtr , Int32 )


On 3/7/08, Dino Viehland <dinov at exchange.microsoft.com> wrote:
> One thing that might help is running w/ -X:ExceptionDetail to get the full .NET stack trace.
>
>  I also suspect this exception must be coming from the finalizer thread or from a newly created thread.  Is your app multi-threaded?  If you create threads w/ Python's thread module then your threads won't rip the process.  In .NET 2.0 the CLR started ripping the process whenever there's an unhandled exception but we wrap new threads w/ an exception handler when starting from thread.
>
>  Other than the fact that it looks like it's on a new thread though it looks like you're calling a method with null as the value and it's expecting an int32.  Unfortunately we're not giving you a very useful stack trace.  Seeing the full .NET stack trace would be interesting because there's probably something we can do to make this better.
>
>
>  -----Original Message-----
>  From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Harri Vartiainen
>  Sent: Friday, March 07, 2008 10:24 AM
>  To: Discussion of IronPython
>  Subject: [IronPython] Crash
>
>  Hi,
>
>   I got my callback eventually working and found one bug/problem:
>
>   If the callback function returns invalid type (eg. None), the
>  IronPython crashes:
>
>  Unhandled exception:
>  Traceback (most recent call last):
>   File , line 0, in System.Int32(Int32, Double, IntPtr, Int32)##154
>  TypeError: Cannot convert NoneType() to Int32
>
>   And then Windows displays the "program crashed - report to Microsoft" -dialog.
>
> _______________________________________________
>  Users mailing list
>  Users at lists.ironpython.com
>  http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>  _______________________________________________
>  Users mailing list
>  Users at lists.ironpython.com
>  http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>



More information about the Ironpython-users mailing list