Re: __builtins__ thread-safe / __builtins__ as function?

Discussion in 'Python' started by Chris Angelico, Oct 11, 2012.

  1. On Fri, Oct 12, 2012 at 1:16 AM, Juergen Bartholomae
    <> 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
     
    Chris Angelico, Oct 11, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. _mario.lat
    Replies:
    9
    Views:
    475
    Richard Tobin
    May 28, 2007
  2. Replies:
    23
    Views:
    928
    Pete Becker
    Sep 18, 2007
  3. Gabriel Rossetti
    Replies:
    0
    Views:
    1,394
    Gabriel Rossetti
    Aug 29, 2008
  4. John Nagle
    Replies:
    5
    Views:
    509
    John Nagle
    Mar 12, 2012
  5. Chris Angelico
    Replies:
    0
    Views:
    168
    Chris Angelico
    Oct 14, 2012
Loading...

Share This Page