mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Close #12028: Make threading._get_ident() public, rename it to
threading.get_ident() and document it. This function was used by _thread.get_ident().
This commit is contained in:
parent
d976098e3b
commit
2a12974bca
12 changed files with 50 additions and 39 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue