diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/bsddb/test/test_associate.py | 2 | ||||
-rw-r--r-- | Lib/bsddb/test/test_join.py | 2 | ||||
-rw-r--r-- | Lib/bsddb/test/test_lock.py | 6 | ||||
-rw-r--r-- | Lib/bsddb/test/test_thread.py | 22 | ||||
-rw-r--r-- | Lib/idlelib/rpc.py | 12 | ||||
-rw-r--r-- | Lib/idlelib/run.py | 4 | ||||
-rw-r--r-- | Lib/socketserver.py | 2 | ||||
-rw-r--r-- | Lib/test/test_threadedtempfile.py | 2 | ||||
-rw-r--r-- | Lib/threading.py | 2 |
9 files changed, 27 insertions, 27 deletions
diff --git a/Lib/bsddb/test/test_associate.py b/Lib/bsddb/test/test_associate.py index b9f250b..2876528 100644 --- a/Lib/bsddb/test/test_associate.py +++ b/Lib/bsddb/test/test_associate.py @@ -9,7 +9,7 @@ import time from pprint import pprint try: - from threading import Thread, currentThread + from threading import Thread, current_thread have_threads = 1 except ImportError: have_threads = 0 diff --git a/Lib/bsddb/test/test_join.py b/Lib/bsddb/test/test_join.py index de674ee..7addf40 100644 --- a/Lib/bsddb/test/test_join.py +++ b/Lib/bsddb/test/test_join.py @@ -8,7 +8,7 @@ import time from pprint import pprint try: - from threading import Thread, currentThread + from threading import Thread, current_thread have_threads = 1 except ImportError: have_threads = 0 diff --git a/Lib/bsddb/test/test_lock.py b/Lib/bsddb/test/test_lock.py index 5baba69..0467d83 100644 --- a/Lib/bsddb/test/test_lock.py +++ b/Lib/bsddb/test/test_lock.py @@ -7,7 +7,7 @@ import tempfile import time try: - from threading import Thread, currentThread + from threading import Thread, current_thread have_threads = 1 except ImportError: have_threads = 0 @@ -117,7 +117,7 @@ class LockingTestCase(unittest.TestCase): deadlock_detection.end=False deadlock_detection.count=0 t=Thread(target=deadlock_detection) - t.setDaemon(True) + t.set_daemon(True) t.start() self.env.set_timeout(100000, db.DB_SET_LOCK_TIMEOUT) anID = self.env.lock_id() @@ -143,7 +143,7 @@ class LockingTestCase(unittest.TestCase): self.assertTrue(deadlock_detection.count>0) def theThread(self, sleepTime, lockType): - name = currentThread().getName() + name = current_thread().get_name() if lockType == db.DB_LOCK_WRITE: lt = "write" else: diff --git a/Lib/bsddb/test/test_thread.py b/Lib/bsddb/test/test_thread.py index e39124e..85d7736 100644 --- a/Lib/bsddb/test/test_thread.py +++ b/Lib/bsddb/test/test_thread.py @@ -12,7 +12,7 @@ from random import random DASH = b'-' try: - from threading import Thread, currentThread + from threading import Thread, current_thread have_threads = True except ImportError: have_threads = False @@ -89,20 +89,20 @@ class BaseThreadedTestCase(unittest.TestCase): self._writerThread(*args, **kwargs) except db.DBLockDeadlockError: if verbose: - print(currentThread().getName(), 'died from', e) + print(current_thread().get_name(), 'died from', e) else: if verbose: - print(currentThread().getName(), "finished.") + print(current_thread().get_name(), "finished.") def readerThread(self, *args, **kwargs): try: self._readerThread(*args, **kwargs) except db.DBLockDeadlockError as e: if verbose: - print(currentThread().getName(), 'died from', e) + print(current_thread().get_name(), 'died from', e) else: if verbose: - print(currentThread().getName(), "finished.") + print(current_thread().get_name(), "finished.") @@ -143,7 +143,7 @@ class ConcurrentDataStoreBase(BaseThreadedTestCase): t.join() def _writerThread(self, d, howMany): - name = currentThread().getName() + name = current_thread().get_name() start = 0 stop = howMany if verbose: @@ -172,7 +172,7 @@ class ConcurrentDataStoreBase(BaseThreadedTestCase): def _readerThread(self, d, readerNum): time.sleep(0.01 * readerNum) - name = currentThread().getName() + name = current_thread().get_name() for loop in range(5): c = d.cursor() @@ -240,7 +240,7 @@ class SimpleThreadedBase(BaseThreadedTestCase): t.join() def _writerThread(self, d, howMany, writerNum): - name = currentThread().getName() + name = current_thread().get_name() start = howMany * writerNum stop = howMany * (writerNum + 1) - 1 if verbose: @@ -286,7 +286,7 @@ class SimpleThreadedBase(BaseThreadedTestCase): def _readerThread(self, d, readerNum): time.sleep(0.01 * readerNum) - name = currentThread().getName() + name = current_thread().get_name() for loop in range(5): c = d.cursor() @@ -385,7 +385,7 @@ class ThreadedTransactionsBase(BaseThreadedTestCase): time.sleep(0.05) def _writerThread(self, d, howMany, writerNum): - name = currentThread().getName() + name = current_thread().get_name() start = howMany * writerNum stop = howMany * (writerNum + 1) - 1 if verbose: @@ -427,7 +427,7 @@ class ThreadedTransactionsBase(BaseThreadedTestCase): def _readerThread(self, d, readerNum): time.sleep(0.01 * readerNum + 0.05) - name = currentThread().getName() + name = current_thread().get_name() for loop in range(5): finished = False diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py index e555ffb..a749353 100644 --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -106,7 +106,7 @@ class RPCServer(socketserver.TCPServer): erf = sys.__stderr__ print('\n' + '-'*40, file=erf) print('Unhandled server exception!', file=erf) - print('Thread: %s' % threading.currentThread().getName(), file=erf) + print('Thread: %s' % threading.current_thread().get_name(), file=erf) print('Client Address: ', client_address, file=erf) print('Request: ', repr(request), file=erf) traceback.print_exc(file=erf) @@ -126,7 +126,7 @@ class SocketIO(object): nextseq = 0 def __init__(self, sock, objtable=None, debugging=None): - self.sockthread = threading.currentThread() + self.sockthread = threading.current_thread() if debugging is not None: self.debugging = debugging self.sock = sock @@ -149,7 +149,7 @@ class SocketIO(object): def debug(self, *args): if not self.debugging: return - s = self.location + " " + str(threading.currentThread().getName()) + s = self.location + " " + str(threading.current_thread().getName()) for a in args: s = s + " " + str(a) print(s, file=sys.__stderr__) @@ -218,7 +218,7 @@ class SocketIO(object): def asynccall(self, oid, methodname, args, kwargs): request = ("CALL", (oid, methodname, args, kwargs)) seq = self.newseq() - if threading.currentThread() != self.sockthread: + if threading.current_thread() != self.sockthread: cvar = threading.Condition() self.cvars[seq] = cvar self.debug(("asynccall:%d:" % seq), oid, methodname, args, kwargs) @@ -228,7 +228,7 @@ class SocketIO(object): def asyncqueue(self, oid, methodname, args, kwargs): request = ("QUEUE", (oid, methodname, args, kwargs)) seq = self.newseq() - if threading.currentThread() != self.sockthread: + if threading.current_thread() != self.sockthread: cvar = threading.Condition() self.cvars[seq] = cvar self.debug(("asyncqueue:%d:" % seq), oid, methodname, args, kwargs) @@ -294,7 +294,7 @@ class SocketIO(object): def _getresponse(self, myseq, wait): self.debug("_getresponse:myseq:", myseq) - if threading.currentThread() is self.sockthread: + if threading.current_thread() is self.sockthread: # this thread does all reading of requests or responses while 1: response = self.pollresponse(myseq, wait) diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index 7a662c9..e2e9f69 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -73,7 +73,7 @@ def main(del_exitfunc=False): sockthread = threading.Thread(target=manage_socket, name='SockThread', args=((LOCALHOST, port),)) - sockthread.setDaemon(True) + sockthread.set_daemon(True) sockthread.start() while 1: try: @@ -227,7 +227,7 @@ class MyRPCServer(rpc.RPCServer): erf = sys.__stderr__ print('\n' + '-'*40, file=erf) print('Unhandled server exception!', file=erf) - print('Thread: %s' % threading.currentThread().getName(), file=erf) + print('Thread: %s' % threading.current_thread().get_name(), file=erf) print('Client Address: ', client_address, file=erf) print('Request: ', repr(request), file=erf) traceback.print_exc(file=erf) diff --git a/Lib/socketserver.py b/Lib/socketserver.py index 2a9ec8a..9409e55 100644 --- a/Lib/socketserver.py +++ b/Lib/socketserver.py @@ -566,7 +566,7 @@ class ThreadingMixIn: t = threading.Thread(target = self.process_request_thread, args = (request, client_address)) if self.daemon_threads: - t.setDaemon (1) + t.set_daemon(True) t.start() diff --git a/Lib/test/test_threadedtempfile.py b/Lib/test/test_threadedtempfile.py index d93b382..7383467 100644 --- a/Lib/test/test_threadedtempfile.py +++ b/Lib/test/test_threadedtempfile.py @@ -63,7 +63,7 @@ class ThreadedTempFileTest(unittest.TestCase): t.join() ok += t.ok_count if t.error_count: - errors.append(str(t.getName()) + str(t.errors.getvalue())) + errors.append(str(t.get_name()) + str(t.errors.getvalue())) threading_cleanup(*thread_info) diff --git a/Lib/threading.py b/Lib/threading.py index 934eeae..cfa9a10 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -856,7 +856,7 @@ def _test(): P = [] for i in range(NP): t = ProducerThread(Q, NI) - t.setName("Producer-%d" % (i+1)) + t.set_name("Producer-%d" % (i+1)) P.append(t) C = ConsumerThread(Q, NI*NP) for t in P: |