Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31121
| References | <CAAj3U_Ce+F6u+mhUy+_3uNXp4ck2QXtUw+7VG4wo9H88hJs0pQ@mail.gmail.com> |
|---|---|
| Date | 2012-10-12 01:25 +1100 |
| Subject | Re: __builtins__ thread-safe / __builtins__ as function? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2054.1349965530.27098.python-list@python.org> (permalink) |
On Fri, Oct 12, 2012 at 1:16 AM, Juergen Bartholomae <bartholomae.juergen@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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: __builtins__ thread-safe / __builtins__ as function? Chris Angelico <rosuav@gmail.com> - 2012-10-12 01:25 +1100
csiph-web