Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
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 ourterms of service andprivacy 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 commentedFeb 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 in67072cc
Refcnt doesn't used - maybe we may remove this reading? cpython/Modules/_testexternalinspection.c Line 1529 in67072cc
This is a typo - should I fix them? get_stack_trace should beget_async_stack_trace |
@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. |
@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 commentedFeb 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
@@ -217,7 +222,9 @@ search_map_for_section(pid_t pid, const char* secname, const char* substr) { | |||
mach_port_t proc_ref = pid_to_task(pid); | |||
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 thattask_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 thinkPyExc_PermissionError
is just exactly for this. I will move it topid_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 keptPyExc_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>
@vstinner Please take a look. |
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
intopython: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
|
@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? |
The automated backport failed because of merge conflicts. @sergey-miryanov: Can you please try to backport this change manually to 3.13? |
sergey-miryanov commentedFeb 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? |
@pablogsal: |
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 |
Uh oh!
There was an error while loading.Please reload this page.
Some error paths don't set Exceptions.
This PR fixes them.