releasing interpreter lock in custom code?

Sion Arrowsmith siona at
Thu May 11 13:08:03 CEST 2006

Bram Stolk  <bram at> wrote:
>I've implemented, in C, a function that does a lot of I/O, and thus
>can block for a long time.
>If I execute this function in my Python script, it does not 
>relinquish the global interpreter lock, like Python's native
>blocking functions do, like I/O funcs, and time.sleep() func.
>How can I have my func release the lock? is the first hit on
searching for "global interpreter lock". It

This is so common that a pair of macros exists to simplify it:

	...Do some blocking I/O operation...

\S -- siona at --
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump

More information about the Python-list mailing list