[IronPython] [python] IP2A4 - Bug when Exception thrown on worker thread

Michael Foord fuzzyman at voidspace.org.uk
Tue Oct 9 21:07:14 CEST 2007


Davy Mitchell wrote:
> Hi - the following snippit crashes IP2A4.
>   

It crashes 1.1 as well. We just kind of accepted that unhandled 
exceptions on threads cause app domain errors.

In CPython it just raises an exception and terminates the thread.

Michael
http://www.manning.com/foord

> import clr
> from System.Threading import ApartmentState,Thread, ThreadStart
>
> def Run():
>     print wibble
>
> t = Thread(ThreadStart(Run))
> t.ApartmentState = ApartmentState.STA
> t.Start()
> Thread.Sleep(90000)
>
> Unhandled Exception: Microsoft.Scripting.UnboundNameException: name 'wibble' is
> not defined
>    at IronPython.Runtime.PythonContext.MissingName(SymbolId name)
>    at Microsoft.Scripting.ModuleGlobalWrapper.GetCachedValue()
>    at Microsoft.Scripting.ModuleGlobalWrapper.get_CurrentValue()
>    at __main__$mod_2.Run$1() in bug.py:line 5
>    at _stub_##17(Object[] , DynamicSite`2 , CodeContext , Object )
>    at Microsoft.Scripting.Actions.DynamicSite`2.UpdateBindingAndInvoke(CodeConte
> xt context, T0 arg0)
>    at Microsoft.Scripting.Actions.DynamicSiteHelpers.UninitializedTargetHelper`7
> .Invoke1(DynamicSite`2 site, CodeContext context, T0 arg0)
>    at Microsoft.Scripting.Actions.DynamicSite`2.Invoke(CodeContext context, T0 a
> rg0)
>    at System.Void(), using PythonBinder##9(Object[] )
>    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
>    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
> ontextCallback callback, Object state)
>    at System.Threading.ThreadHelper.ThreadStart()
>
>   




More information about the Ironpython-users mailing list