Awesome Reviewers

When writing C extension/interpreter code, treat every fallible C API call as a potential failure point and handle it consistently:

Example of correct failure-check idiom and resource cleanup:

long fold_int = PyLong_AsLong(fold_obj);
Py_DECREF(fold_obj);
if (fold_int == -1 && PyErr_Occurred()) {
    return NULL;
}
if (fold_int < 0 || fold_int > 1) {
    PyErr_Format(PyExc_ValueError, "fold must be 0 or 1, got %ld", fold_int);
    return NULL;
}
fold = (unsigned char)fold_int;

Applying this consistently prevents silent data corruption from unchecked UB casts, memory leaks/double-frees on error paths, and confusing failures where errors are swallowed, misclassified, or propagate inconsistently.