summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-05-30 21:02:52 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-05-30 21:02:52 (GMT)
commit2a12974bca2433eea0131d904a423ed8234dcf7a (patch)
treee238e53c319beb8f913e3411fa91a98504d1743d /Lib/logging
parentd976098e3bb53b9c52d55a303e1389a102ed8bae (diff)
downloadcpython-2a12974bca2433eea0131d904a423ed8234dcf7a.zip
cpython-2a12974bca2433eea0131d904a423ed8234dcf7a.tar.gz
cpython-2a12974bca2433eea0131d904a423ed8234dcf7a.tar.bz2
Close #12028: Make threading._get_ident() public, rename it to
threading.get_ident() and document it. This function was used by _thread.get_ident().
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 3a8a639..1a4b241 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -41,10 +41,9 @@ except ImportError: #pragma: no cover
codecs = None
try:
- import _thread as thread
import threading
except ImportError: #pragma: no cover
- thread = None
+ threading = None
__author__ = "Vinay Sajip <vinay_sajip@red-dove.com>"
__status__ = "production"
@@ -199,7 +198,7 @@ def _checkLevel(level):
#the lock would already have been acquired - so we need an RLock.
#The same argument applies to Loggers and Manager.loggerDict.
#
-if thread:
+if threading:
_lock = threading.RLock()
else: #pragma: no cover
_lock = None
@@ -278,8 +277,8 @@ class LogRecord(object):
self.created = ct
self.msecs = (ct - int(ct)) * 1000
self.relativeCreated = (self.created - _startTime) * 1000
- if logThreads and thread:
- self.thread = thread.get_ident()
+ if logThreads and threading:
+ self.thread = threading.get_ident()
self.threadName = threading.current_thread().name
else: # pragma: no cover
self.thread = None
@@ -773,7 +772,7 @@ class Handler(Filterer):
"""
Acquire a thread lock for serializing access to the underlying I/O.
"""
- if thread:
+ if threading:
self.lock = threading.RLock()
else: #pragma: no cover
self.lock = None