Skip to content

Commit 69f8d49

Browse files
[python v3.13] TestTestgresCommon::test_logging uses logging._lock (#276)
Python 3.13 deleted the following internale functions: - logging._acquireLock() - logging._releaseLock() See python/cpython@74723e1 (Sep 27, 2023) logging._lock was not touched. So, we use "with logging._lock" instead this pair of deleted function. Patch was tested with python v3.8.0
1 parent d6be913 commit 69f8d49

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tests/test_testgres_common.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -622,13 +622,12 @@ def LOCAL__test_lines():
622622
assert (master._logger.is_alive())
623623
finally:
624624
# It is a hack code to logging cleanup
625-
logging._acquireLock()
626-
assert logging.Logger.manager is not None
627-
assert C_NODE_NAME in logging.Logger.manager.loggerDict.keys()
628-
logging.Logger.manager.loggerDict.pop(C_NODE_NAME, None)
629-
assert not (C_NODE_NAME in logging.Logger.manager.loggerDict.keys())
630-
assert not (handler in logging._handlers.values())
631-
logging._releaseLock()
625+
with logging._lock:
626+
assert logging.Logger.manager is not None
627+
assert C_NODE_NAME in logging.Logger.manager.loggerDict.keys()
628+
logging.Logger.manager.loggerDict.pop(C_NODE_NAME, None)
629+
assert not (C_NODE_NAME in logging.Logger.manager.loggerDict.keys())
630+
assert not (handler in logging._handlers.values())
632631
# GO HOME!
633632
return
634633

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy