Penguin

Differences between current version and previous revision of PythonNotes.

Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History

Newer page: version 7 Last edited on Tuesday, April 22, 2008 9:13:42 am by JohnMcPherson
Older page: version 6 Last edited on Wednesday, December 12, 2007 12:03:47 pm by JohnMcPherson Revert
@@ -17,9 +17,9 @@
  
 !!! threads 
  
 !! subprocess module 
-If you use the ''subprocess'' module to spawn a child in one of your threads and you are using locks, there is a possibility of a deadlock. See the discussion in the [python newsgroup|http://groups.google.com/group/comp.lang.python/browse_thread/thread/5fae8a453c95ae89/42f5c9f9215dbb1e#42f5c9f9215dbb1e]. Basically, python internally uses locks during imports, and you can fix it in this instance by moving the ''"from errno import ENOENT, ENOTDIR"'' line from the ''_execvpe'' function in the subprocess .py module up to the top, so that it doesn't happen after the fork(). This affects python 2.4 at least, not sure if it's fixed in 2.5. 
+If you use the ''subprocess'' module to spawn a child in one of your threads and you are using locks, there is a possibility of a deadlock. See the discussion in the [python newsgroup|http://groups.google.com/group/comp.lang.python/browse_thread/thread/5fae8a453c95ae89/42f5c9f9215dbb1e#42f5c9f9215dbb1e]. Basically, python internally uses locks during imports, and you can fix it in this instance by moving the ''"from errno import ENOENT, ENOTDIR"'' line from the ''_execvpe'' function in the os .py module up to the top, so that it doesn't happen after the fork(). This affects python 2.4 at least, not sure if it's fixed in 2.5. 
  
 The ''subprocess'' module is also buggy if you have multiple threads using subprocess to create child processes. Basically, it isn't thread-safe when checking if a child has finished, and you occasionally get "<tt>~[Errno 10] No child processes</tt>" exceptions. See [mailing list thread|http://www.mail-archive.com/python-bugs-list@python.org/msg12685.html]. 
  
 !! python-gtk