-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Raise SystemError on programmical errors in PyArg_Parse*() #70500
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
Comments
For now programmical errors with the use of PyArg_ParseTuple() cause raising SystemError. But some programmical errors with the use of PyArg_ParseTupleAndKeywords() cause raising RuntimeError. I think that SystemError is the correct exception type. Proposed patch replaces RuntimeError with SystemError in PyArg_ParseTupleAndKeywords(). This change shouldn't break any code (except CPython tests for PyArg_ParseTupleAndKeywords()), because this exception never raised if PyArg_Parse*() functions are used correctly. |
Seems like a reasonable change and patch to me. |
Yeah, I also expect SystemError from C functions (of the Python C API) badly used. RuntimeError is more used in programming bugs at Python level. pyarg_parse_error.patch LGTM. |
It feels a bit odd to say that I've performed a triage review given the three people already involved -- but I did, and I think it is ready to commit. I believe it is a bug fix, but too subtle a bug to justify backporting. The only question is whether there should be a "What's New?" entry for the change. |
I don't think so. It's low level and nobody should see this exception anyway :-) It's an obvious bug in a C extension. |
SystemError is not new exception. It could be raised on other programming bugs. In any case I doesn't expect that anybody catches such exceptions. |
New changeset c7eff18f3840 by Serhiy Storchaka in branch 'default': |
Thanks for your review. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: