Internal Python interpreter error
Production Risk
CRITICAL — indicates CPython or C extension bug; file a bug report and restart the process.
Raised when the Python interpreter itself encounters an internal error. This is distinct from OS errors; it means a bug in the CPython implementation or a C extension module.
- 1A C extension module returns an invalid value to the Python C API
- 2A bug in a third-party C extension
- 3CPython internal state corruption (very rare)
A buggy C extension returns NULL without setting an exception.
# Typically triggered by C extension bugs, not pure Python # Example: calling a broken C extension function import buggy_extension buggy_extension.bad_function()
expected output
SystemError: NULL result without error in PyObject_Call
Fix
Update or report the buggy extension
WHEN When SystemError is raised from a C extension
# Check which extension triggered it
import traceback
try:
buggy_extension.bad_function()
except SystemError:
traceback.print_exc()
# Update the extension or file a bug reportWhy this works
SystemError almost always indicates a bug in a C extension; update to a fixed version or report the bug.
# Typically from a buggy C extension: import buggy_ext buggy_ext.bad_function() # SystemError: NULL result without error
try:
result = ext.call()
except SystemError as e:
import traceback; traceback.print_exc()
result = None# Pin a known-good version of the C extension: # pip install some-ext==1.2.3 # Or file a bug report with the traceback
✕ Catch SystemError and continue
SystemError indicates internal interpreter corruption; the Python process may be in an undefined state.
Python Docs — Built-in Exceptions
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev