python / python/cpython

Document the current practice for SystemError

Open
#95,799 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3.10 3.11 3.12 docs topic-C-API
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

@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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the SystemError section at docs.python.org/3/library/exceptions.html#SystemError and review the issue's description of improper C API use. Update the documentation to reflect the stated current practice, including detectable misuse in extensions, and ensure the resulting text no longer implies that CPython internal errors are the only source.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.