Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-130052: Fix some exceptions on error paths in _testexternalinspection#130053
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-130052: Fix some exceptions on error paths in _testexternalinspection #130053
Uh oh!
There was an error while loading. Please reload this page.
Conversation
sergey-miryanov commented Feb 12, 2025 • edited by bedevere-app bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-app bot
Uh oh!
There was an error while loading. Please reload this page.
sergey-miryanov commented Feb 13, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
cpython/Modules/_testexternalinspection.c Line 917 in 67072cc
Refcnt doesn't used - maybe we may remove this reading? cpython/Modules/_testexternalinspection.c Line 1529 in 67072cc
This is a typo - should I fix them? get_stack_trace should be get_async_stack_trace |
sergey-miryanov commented Feb 13, 2025
@pablogsal Please take a look. I saw your fixed some calls (#129557), I added a few more exceptions. I also added a check of the result before it is used. |
vstinner commented Feb 17, 2025
@sergey-miryanov: Why did you mark this PR as a draft? Do you expect to add more changes? Or is there something else? |
sergey-miryanov commented Feb 17, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@vstinner oops! I forgot to un-draft it. Thanks! |
Modules/_testexternalinspection.c Outdated
| if (proc_ref==0){ | ||
| PyErr_SetString(PyExc_PermissionError, "Cannot get task for PID"); | ||
| if (!PyErr_Occurred()){ | ||
| PyErr_SetString(PyExc_PermissionError, "Cannot get task for PID"); |
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.
Would it be posssible to move this code inside pid_to_task()? I'm not convinced that PermissionError is appropriate, I would suggest RuntimeError instead.
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.
I believe it is redundant here. I will remove this check. But I saw on the internets that task_for_pid may return code == 5 (os/kern failure) that we don't check - should we?
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.
Oh! I think PyExc_PermissionError is just exactly for this. I will move it to pid_to_task.
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.
I kept PyExc_PermissionError and removed redundant check. Should I replace PermissionError with RuntimeError?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Victor Stinner <vstinner@python.org>
sergey-miryanov commented Feb 17, 2025
@vstinner Please take a look. |
vstinner left a comment
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.
69426fc into python:mainUh oh!
There was an error while loading. Please reload this page.
Thanks @sergey-miryanov for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, @sergey-miryanov and @vstinner, I could not cleanly backport this to |
sergey-miryanov commented Feb 20, 2025
@vstinner It looks like a lot of changes were made on 3.14 branch and not on 3.13. Should we backport this PR then? |
vstinner commented Feb 21, 2025
The automated backport failed because of merge conflicts. @sergey-miryanov: Can you please try to backport this change manually to 3.13? |
sergey-miryanov commented Feb 21, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@vstinner I tried yesterday yet. There are commits that not backported: Should I backport them all? |
vstinner commented Feb 21, 2025
@pablogsal: |
pablogsal commented Feb 21, 2025
3.13 has half the test cases because there is no async-related introspection and most of the bugs we have been fixing are in the new code. I will try to go over the PRs and see if anything applies to the other code that we had |
serhiy-storchaka commented Aug 14, 2025
Reminder about backporting. @sergey-miryanov |
sergey-miryanov commented Aug 14, 2025
I'm afraid it is on @pablogsal side now. I'm not against of backporting those commits and if we decide to do this I'm ready to work on backporting. |
serhiy-storchaka commented Dec 26, 2025
If it was decided to not backport this, please remove the "needs backport to 3.13" label. |
Some error paths don't set Exceptions.
This PR fixes them.