-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
gh-109461: Update logging module lock acquisition to use context manager #109462
gh-109461: Update logging module lock acquisition to use context manager #109462
Conversation
…t manager so that it is safer and easier to use.
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
…ock-acquisition' into pythongh-109461-update-logging-lock-acquisition
…text manager, or a null context.
…ock-acquisition' into pythongh-109461-update-logging-lock-acquisition
…ock-acquisition' into pythongh-109461-update-logging-lock-acquisition
Misc/NEWS.d/next/Library/2023-09-15-17-12-53.gh-issue-109461.VNFPTK.rst
Outdated
Show resolved
Hide resolved
… bool(_lock) always returns true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. But I leave our logging expert to take the final decision on this change. @vsajip
You don't have to do that. I will be done when the PR will be merged into main (if it's merged). |
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. |
🤖 New build scheduled with the buildbot fleet by @AA-Turner for commit 797ae0d 🤖 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 issues https://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 issue gh-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) {
goto error;
}
}
} |
|
|
…ython#109462) Co-authored-by: Victor Stinner <vstinner@python.org>
…ython#109462) Co-authored-by: Victor Stinner <vstinner@python.org>
Updated logging library to acquire its module lock using a context manager so that it is safer and easier to use.