With regard to this post: Python del Statement,
I recently encountered the following snippet:
# custom_process.py
import threading
import subprocess
myList = []  # module-wide list
class Foo(threading.Thread):
    myprocess = None     
    returncode = None
    def run(self):
        self.myprocess = subprocess.Popen(...)
        global myList
        myList.append(self.myprocess)
        ...  # Code skipped for brevity
        self.returncode = self.myprocess.returncode
        tmp1, tmp2 = self.myprocess.communicate()
        ...  # Code skipped for brevity
        del self.myprocess
This code upon successive calls to Foo's run method,  would exhaust the available file descriptors on the system and would throw the exception: too many open files. 
Therefore I was wondering... When dealing with subprocess objects, do the file descriptors close along with the actual OS process or when the reference count to the Python subprocess object becomes zero?
Thanks in advance.
 
     
     
     
     
    