On Fri, Oct 12, 2012 at 1:16 AM, Juergen Bartholomae <bartholomae.juer...@googlemail.com> wrote: > One possible solution is to somehow redirect every __builtins__ to a > function that returns a different __builtins__ dictionary for each thread > (such a function already exists).
How exactly does the code reference it? If they're simply referring to the name __builtins__ at module level, you ought to be able to import the module, then assign some_module.__builtins__ to your thread-local object, then call code in it as normal. An interesting problem, and one where monkeypatching is, imho, justified. ChrisA -- http://mail.python.org/mailman/listinfo/python-list