Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
gh-109461: Update logging module lock acquisition to use context manager#109462
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
gh-109461: Update logging module lock acquisition to use context manager#109462
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…t manager so that it is safer and easier to use.
ghost commentedSep 15, 2023 • edited by ghost
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by ghost
Uh oh!
There was an error while loading.Please reload this page.
Most changes to Pythonrequire a NEWS entry. Please add it using theblurb_it web app or theblurb command-line tool. |
Uh oh!
There was an error while loading.Please reload this page.
…ock-acquisition' intopythongh-109461-update-logging-lock-acquisition
Uh oh!
There was an error while loading.Please reload this page.
…text manager, or a null context.
…ock-acquisition' intopythongh-109461-update-logging-lock-acquisition
…ock-acquisition' intopythongh-109461-update-logging-lock-acquisition
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Library/2023-09-15-17-12-53.gh-issue-109461.VNFPTK.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
… bool(_lock) always returns true
bedevere-bot commentedSep 22, 2023
I'm away for a couple of weeks (with sporadic Internet access) and have set off tests in the buildbot fleet, with some results still to come in. If all the failures are unrelated to this change, I think we can merge this PR. |
Sadly, there are many unstable tests these days, I'm trying to fix most of them. I mean: most failures are unrelated to this PR. But someone has to check. Or later, you can rebase the PR on the main branch, and schedule a new buildbot job. |
bedevere-bot commentedSep 26, 2023
🤖 New build scheduled with the buildbot fleet by@AA-Turner for commit797ae0d 🤖 If you want to schedule another build, you need to add the🔨 test-with-buildbots label again. |
Ubuntu reports |
There are many unstable tests. All "FAILURE then SUCCESS" are unstable tests. They are unrelated to this change and you can ignore them. You can browse into my issueshttps://github.com/python/cpython/issues/vstinner to see recent unstable tests. |
10 buildbots failed:
None seem logging related, so seems safe to merge. A |
@vsajip, maintainer of logging wrote:
In short, he approved the PR. |
Merged. Thanks@dcollison, it's a nice cleanup. It may make the logging safer, since Example in Python 3.10, see also issuegh-74225: if (_Py_atomic_load_relaxed(eval_breaker)) {opcode=_Py_OPCODE(*next_instr);if (opcode!=SETUP_FINALLY&&opcode!=SETUP_WITH&&opcode!=BEFORE_ASYNC_WITH&&opcode!=YIELD_FROM) {/* Few cases where we skip running signal handlers and other pending calls: - If we're about to enter the 'with:'. It will prevent emitting a resource warning in the common idiom 'with open(path) as file:'. - If we're about to enter the 'async with:'. - If we're about to enter the 'try:' of a try/finally (not *very* useful, but might help in some cases and it's traditional) - If we're resuming a chain of nested 'yield from' or 'await' calls, then each frame is parked with YIELD_FROM as its next opcode. If the user hit control-C we want to wait until we've reached the innermost frame before running the signal handler and raising KeyboardInterrupt (see bpo-30039). */if (eval_frame_handle_pending(tstate)!=0) { gotoerror; } } } |
bedevere-bot commentedSep 27, 2023
|
bedevere-bot commentedSep 27, 2023
|
…ython#109462)Co-authored-by: Victor Stinner <vstinner@python.org>
…ython#109462)Co-authored-by: Victor Stinner <vstinner@python.org>
python/cpython#109462 removed`logging._acquireLock`. Fortunately,python/cpython#3385 simplified lock creation sothat `with logging._lock:` is sufficient; that PR made it into Python3.7, which is already pastescript's minimum Python requirement.
python/cpython#109462 removed`logging._acquireLock`. Fortunately,python/cpython#3385 simplified lock creation sothat `with logging._lock:` is sufficient; that PR made it into Python3.7, which is already pastescript's minimum Python requirement.
Uh oh!
There was an error while loading.Please reload this page.
Updated logging library to acquire its module lock using a context manager so that it is safer and easier to use.