8000 [python v3.13] TestTestgresCommon::test_logging uses logging._lock by dmitry-lipetsk · Pull Request #276 · postgrespro/testgres · GitHub
[go: up one dir, main page]

Skip to content

[python v3.13] T 8000 estTestgresCommon::test_logging uses logging._lock #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[python v3.13] TestTestgresCommon::test_logging uses logging._lock
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
  • Loading branch information
dmitry-lipetsk committed Jun 27, 2025
commit b17d4b3cee73bb54e090d4b7c2f9f0151488d072
13 changes: 6 additions & 7 deletions tests/test_testgres_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,13 +622,12 @@ def LOCAL__test_lines():
assert (master._logger.is_alive())
finally:
# It is a hack code to logging cleanup
logging._acquireLock()
assert logging.Logger.manager is not None
assert C_NODE_NAME in logging.Logger.manager.loggerDict.keys()
logging.Logger.manager.loggerDict.pop(C_NODE_NAME, None)
assert not (C_NODE_NAME in logging.Logger.manager.loggerDict.keys())
assert not (handler in logging._handlers.values())
logging._releaseLock()
with logging._lock:
assert logging.Logger.manager is not None
assert C_NODE_NAME in logging.Logger.manager.loggerDict.keys()
logging.Logger.manager.loggerDict.pop(C_NODE_NAME, None)
assert not (C_NODE_NAME in logging.Logger.manager.loggerDict.keys())
assert not (handler in logging._handlers.values())
# GO HOME!
return

Expand Down
0