[ ... ]
>
> It turned out that I needed to recover the actual object if I did hit
> a recursive problem, and this seemed about the only way to make it
> available (gracefully). If you don't know what I mean by the
> "recursive" problem, try executing the following three lines of code
> (which will crash python, as might be guessed by the warning in the
> reference manual):
>
> L = []
> L.append(L)
> `L`
>
> It really pays to remember what you are trying to represent ;-).
>
As will marshal.dumps( L )
Naievely copying and the codeobject case and modifying it for
funcobject in marshal.c
else if (is_funcobject(v)) {
funcobject *fn = (funcobject *) v;
w_byte(TYPE_CODE, p);
w_object(fn->func_code, p );
w_object(fn->func_globals, p );
w_object(fn->func_name, p );
}
Will also (usually) give you a nice infinite recursion on
marshal.dumps( function ), as it tries to dump function's
.func_globals dict, which in many cases contains other
function objects.
I know this for a fact. I *am* naive! :-)
But now I know that the the non inclusion of various types from
marshal was not an unintentional oversight!
- Steve Majewski (804-982-0831) <sdm7g@Virginia.EDU>
- UVA Department of Molecular Physiology and Biological Physics