Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: "RuntimeError: dictionary changed size during iteration" ;Good atomic copy operations?

Reply
Thread Tools

Re: "RuntimeError: dictionary changed size during iteration" ;Good atomic copy operations?

 
 
Jean-Paul Calderone
Guest
Posts: n/a
 
      03-13-2006
On 12 Mar 2006 17:56:37 -0800, Raymond Hettinger <(E-Mail Removed)> wrote:
>
>Thinking about future directions for Python threading, I wonder if
>there is a way to expose the GIL (or simply impose a temporary
>moratorium on thread switches) so that it becomes easy to introduce
>atomicity when needed:
>
> gil.acquire(BLOCK=True)
> try:
> #do some transaction that needs to be atomic
> finally:
> gil.release()
>


This is vaguely possible using sys.setcheckinterval() now, although one has to pick a ridiculously large number and hope that the atomic operation takes fewer than that many opcodes.

Spelling "do not switch threads" as sys.setcheckinterval(None) seems somewhat natural, though. Perhaps that would be a fruitful direction to explore.

Jean-Paul
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dictionary size changed during iteration Laszlo Nagy Python 3 04-22-2011 06:22 AM
RuntimeError: dictionary changed size during iteration Robert Dailey Python 6 12-09-2008 06:25 PM
"RuntimeError: dictionary changed size during iteration" ; Good atomiccopy operations? robert Python 29 03-14-2006 06:22 AM
Re: RuntimeError: dictionary changed size during iteration Terry Reedy Python 0 01-20-2005 06:40 PM
RuntimeError: dictionary changed size during iteration Roman Suzi Python 0 01-19-2005 08:45 PM



Advertisments