From: Finn B. <bc...@us...> - 2002-11-06 08:20:34
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17491 Modified Files: popen2.py Log Message: Delay import of 'threading' until actually needed. 'threading' imports atexit and atexit has sideeffects and since popen2 is imported by site.py (by 'os') the sideeffects could not be controlled by user scripts. Index: popen2.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/popen2.py,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -d -r2.3 -r2.4 *** popen2.py 5 Nov 2002 16:12:33 -0000 2.3 --- popen2.py 6 Nov 2002 08:20:31 -0000 2.4 *************** *** 23,27 **** import jarray from java.lang import System - import threading from java.util import * from java.io import * --- 23,26 ---- *************** *** 55,59 **** sts = -1 # Child not completed yet childWaiter = None - childWaiterLock = threading.Lock() count = 0 --- 54,57 ---- *************** *** 75,78 **** --- 73,78 ---- else: self._childerr = None + import threading + childWaiterLock = threading.Lock() if bufsize > 0: *************** *** 95,98 **** --- 95,99 ---- try: if not self.childWaiter: + import threading self.childWaiter = threading.Thread( target=self.wait, *************** *** 127,130 **** --- 128,132 ---- name = name or str( Popen3.count ) threadName = "StreamReader %s" % name + import threading reader = threading.Thread( target=_readStream, |