SystemError
PythonCRITICALRuntime ErrorHIGH confidence

Internal Python interpreter error

Production Risk

CRITICAL — indicates CPython or C extension bug; file a bug report and restart the process.

What this means

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.

Why it happens
  1. 1A C extension module returns an invalid value to the Python C API
  2. 2A bug in a third-party C extension
  3. 3CPython internal state corruption (very rare)
How to reproduce

A buggy C extension returns NULL without setting an exception.

trigger — this will error
trigger — this will error
# 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

Update or report the buggy 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 report

Why this works

SystemError almost always indicates a bug in a C extension; update to a fixed version or report the bug.

Code examples
Triggerpython
# Typically from a buggy C extension:
import buggy_ext
buggy_ext.bad_function()  # SystemError: NULL result without error
Handle with try/exceptpython
try:
    result = ext.call()
except SystemError as e:
    import traceback; traceback.print_exc()
    result = None
Avoid by updating extensionspython
# Pin a known-good version of the C extension:
# pip install some-ext==1.2.3
# Or file a bug report with the traceback
What not to do

Catch SystemError and continue

SystemError indicates internal interpreter corruption; the Python process may be in an undefined state.

Same error in other languages
Sources
Official documentation ↗

Python Docs — Built-in Exceptions

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Python errors