bson/_cbsonmodule.c
/* Safely downcast from Py_ssize_t to int, setting an
 * exception and returning -1 on error. */
Safely downcast from Py_ssize_t to int, setting an
exception and returning -1 on error.
Safely downcast from Py_ssize_t to int setting an exception and returning - 1 on error .
static int
_downcast_and_check(Py_ssize_t size, int extra) {
    if (size > BSON_MAX_SIZE || ((BSON_MAX_SIZE - extra) < size)) {
        PyObject* InvalidStringData = _error("InvalidStringData");
        if (InvalidStringData) {
            PyErr_SetString(InvalidStringData,
                            "String length must be <= 2147483647");
            Py_DECREF(InvalidStringData);
        }
        return -1;
    }
    return (int)size + extra;
}
static int _downcast_and_check ( Py_ssize_t size , int extra ) { if ( size > BSON_MAX_SIZE || ( ( BSON_MAX_SIZE - extra ) < size ) ) { PyObject * InvalidStringData = _error ( " " ) ; if ( InvalidStringData ) { PyErr_SetString ( InvalidStringData , " " ) ; Py_DECREF ( InvalidStringData ) ; } return -1 ; } return ( int ) size + extra ; }
Safely downcast from Py_ssize_t to int, setting an
 exception and returning -1 on error.
Safely downcast from Py_ssize_t to int setting an exception and returning - 1 on error .