Skip to content
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

Document the current practice for SystemError #95799

Open
serhiy-storchaka opened this issue Aug 8, 2022 · 1 comment
Open

Document the current practice for SystemError #95799

serhiy-storchaka opened this issue Aug 8, 2022 · 1 comment
Labels
3.10 only security fixes 3.11 only security fixes 3.12 bugs and security fixes docs Documentation in the Doc dir topic-C-API

Comments

@serhiy-storchaka
Copy link
Member

@malemburg pointed that the documentation of SystemError only refers to CPython internal errors as the source.

https://docs.python.org/3/library/exceptions.html#SystemError

On practice, SystemError is also raised on improper use of the C API (like NULL pointer, or negative size, or wrong type in the concrete API) if it is possible to detect such error and it is not too costly (macros usually lack any argument checks). An alternative to SystemError is a crash or memory corruption. Currently the main source of SystemError is errors in third-party extensions, not in the Python core or standard extensions.

The documentation looks outdated, perhaps it predates the public C API.

@serhiy-storchaka serhiy-storchaka added docs Documentation in the Doc dir 3.11 only security fixes 3.10 only security fixes topic-C-API 3.12 bugs and security fixes labels Aug 8, 2022
@vstinner
Copy link
Member

vstinner commented Aug 9, 2022

_Py_CheckFunctionResult() is another example: if a function returns non-NULL with an exception set, SystemError is raised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.10 only security fixes 3.11 only security fixes 3.12 bugs and security fixes docs Documentation in the Doc dir topic-C-API
Projects
None yet
Development

No branches or pull requests

2 participants