bson/_cbsonmodule.c
/*
 * Get a reference to a pure python type. If we are in the
 * main interpreter return the cached object, otherwise import
 * the object we need and return it instead.
 */
Get a reference to a pure python type. If we are in the
main interpreter return the cached object, otherwise import
the object we need and return it instead.
Get a reference to a pure python type . If we are in the main interpreter return the cached object otherwise import the object we need and return it instead .
static PyObject*
_get_object(PyObject* object, char* module_name, char* object_name) {
    if (_in_main_interpreter()) {
        Py_XINCREF(object);
        return object;
    } else {
        PyObject* imported = NULL;
        PyObject* module = PyImport_ImportModule(module_name);
        if (!module)
            return NULL;
        imported = PyObject_GetAttrString(module, object_name);
        Py_DECREF(module);
        return imported;
    }
}
static PyObject * _get_object ( PyObject * object , char * module_name , char * object_name ) { if ( _in_main_interpreter ( ) ) { Py_XINCREF ( object ) ; return object ; } else { PyObject * imported = NULL ; PyObject * module = PyImport_ImportModule ( module_name ) ; if ( ! module ) return NULL ; imported = PyObject_GetAttrString ( module , object_name ) ; Py_DECREF ( module ) ; return imported ; } }
Get a reference to a pure python type.
Get a reference to a pure python type .