[Python-checkins] python/dist/src/Lib threading.py,1.30,1.31

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
Mon, 30 Dec 2002 15:32:52 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv8439

Modified Files:
	threading.py 
Log Message:
- prefer "import ... as" to "import / (assignments) / del" for most things
- when the thread module isn't available, subsequent attempts to import
  threading should not suceed


Index: threading.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** threading.py	30 Dec 2002 21:59:55 -0000	1.30
--- threading.py	30 Dec 2002 23:32:50 -0000	1.31
***************
*** 1,9 ****
  """Thread module emulating a subset of Java's threading model."""
  
! import sys
! import time
! import thread
! import traceback
! import StringIO
  
  # Rename some stuff so "from threading import *" is safe
--- 1,15 ----
  """Thread module emulating a subset of Java's threading model."""
  
! import sys as _sys
! 
! try:
!     import thread
! except ImportError:
!     del _sys.modules[__name__]
!     raise
! 
! from StringIO import StringIO as _StringIO
! from time import time as _time, sleep as _sleep
! from traceback import print_exc as _print_exc
  
  # Rename some stuff so "from threading import *" is safe
***************
*** 11,21 ****
             'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', 'Timer']
  
- _sys = sys
- del sys
- 
- _time = time.time
- _sleep = time.sleep
- del time
- 
  _start_new_thread = thread.start_new_thread
  _allocate_lock = thread.allocate_lock
--- 17,20 ----
***************
*** 23,32 ****
  ThreadError = thread.error
  del thread
- 
- _print_exc = traceback.print_exc
- del traceback
- 
- _StringIO = StringIO.StringIO
- del StringIO
  
  
--- 22,25 ----