[Python-checkins] python/dist/src/Lib Queue.py,1.17,1.18 tempfile.py,1.53,1.54
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Mon, 30 Dec 2002 14:36:12 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv16005
Modified Files:
Queue.py tempfile.py
Log Message:
Use the dummy_thread module in Queue.py and tempfile.py.
tempfile.py already contained code to let it run without threads present;
for Queue.py this is considered a useful feature too.
Index: Queue.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/Queue.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** Queue.py 15 Oct 2002 15:11:13 -0000 1.17
--- Queue.py 30 Dec 2002 22:36:09 -0000 1.18
***************
*** 17,21 ****
If maxsize is <= 0, the queue size is infinite.
"""
! import thread
self._init(maxsize)
self.mutex = thread.allocate_lock()
--- 17,24 ----
If maxsize is <= 0, the queue size is infinite.
"""
! try:
! import thread
! except ImportError:
! import dummy_thread as thread
self._init(maxsize)
self.mutex = thread.allocate_lock()
Index: tempfile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** tempfile.py 22 Nov 2002 15:56:29 -0000 1.53
--- tempfile.py 30 Dec 2002 22:36:09 -0000 1.54
***************
*** 51,60 ****
try:
import thread as _thread
! _allocate_lock = _thread.allocate_lock
! except (ImportError, AttributeError):
! class _allocate_lock:
! def acquire(self):
! pass
! release = acquire
_text_openflags = _os.O_RDWR | _os.O_CREAT | _os.O_EXCL
--- 51,57 ----
try:
import thread as _thread
! except ImportError:
! import dummy_thread as _thread
! _allocate_lock = _thread.allocate_lock
_text_openflags = _os.O_RDWR | _os.O_CREAT | _os.O_EXCL