I'd imagine Cecil would work but it might be overkill - you could just use .NET 
reflection:

try:
    raise Exception()
except:
    import sys
    tb = sys.exc_info()[2]

tbtype = type(tb)

import clr
import System
clr.GetClrType(tbtype).GetField('_next', 
System.Reflection.BindingFlags.NonPublic|System.Reflection.BindingFlags.Instance).SetValue(tb,
 None)

Just replace None w/ the value you want to set it to.  For 1.x change '_next' 
to 'next'.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Riley
Sent: Friday, June 13, 2008 3:16 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Setting tb_next

Could you use something like Cecil for this?



On 6/13/08, Dan Eloff <[EMAIL PROTECTED]> wrote:
> It's readonly in Python, and that's the way it's meant to be. But I'm
> porting Jinja2 to IronPython (Silverlight hopefully) and Jinja uses
> ctypes to dig deep into CPython's guts and make a function for setting
> tb_next on traceback objects. Playing by the same dirty, no holds
> barred rules, is there a way to set tb_next on traceback objects in
> IronPython?
>
> Thanks,
> -Dan
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>

--
Sent from Gmail for mobile | mobile.google.com
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to