Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31121 > unrolled thread

Re: __builtins__ thread-safe / __builtins__ as function?

Started byChris Angelico <rosuav@gmail.com>
First post2012-10-12 01:25 +1100
Last post2012-10-12 01:25 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: __builtins__ thread-safe / __builtins__ as function? Chris Angelico <rosuav@gmail.com> - 2012-10-12 01:25 +1100

#31121 — Re: __builtins__ thread-safe / __builtins__ as function?

FromChris Angelico <rosuav@gmail.com>
Date2012-10-12 01:25 +1100
SubjectRe: __builtins__ thread-safe / __builtins__ as function?
Message-ID<mailman.2054.1349965530.27098.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web