Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0a6334d

Browse files
committed
minor speedup
1 parent b02363b commit 0a6334d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/core/common.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -836,10 +836,11 @@ def singleTimeLogMessage(message, level=logging.INFO, flag=None):
836836
logger.log(level, message)
837837

838838
def dataToStdout(data, forceOutput=False):
839-
if not ('threadException' in kb and kb.threadException):
839+
if not kb.get("threadException"):
840840
if forceOutput or not getCurrentThreadData().disableStdOut:
841841
try:
842-
logging._acquireLock()
842+
if kb.get("multiThreadMode"):
843+
logging._acquireLock()
843844
# Reference: http://bugs.python.org/issue1602
844845
if IS_WIN:
845846
output = data.encode('ascii', "replace")
@@ -861,7 +862,8 @@ def dataToStdout(data, forceOutput=False):
861862
sys.stdout.write(data.encode(UNICODE_ENCODING))
862863
finally:
863864
sys.stdout.flush()
864-
logging._releaseLock()
865+
if kb.get("multiThreadMode"):
866+
logging._releaseLock()
865867

866868
def dataToSessionFile(data):
867869
if not conf.sessionFile or kb.suppressSession:

0 commit comments

Comments
 (0)