> I think that the code constructor (types.CodeType) doesn't take > co_freevars or co_cellvars as an arg, so I can't directly create a new > code object from the attribute of the old one with co_freevars and > co_cellvars.
Yay for hidden documentation: "code(argcount, nlocals, stacksize, flags, codestring, constants, names, varnames, filename, name, firstlineno, lnotab[, freevars[, cellvars]]) Create a code object. Not for the faint of heart." -- http://mail.python.org/mailman/listinfo/python-list