ext/redrat_ext/redrat_ext.c
/*
 * redrat_getattr - Get attributes from a PythonValue via a PythonValue
 *
 * Nominally the second argument will be constructed via the 'unicode' method
 * provided in this module.
 */
Get attributes from a PythonValue via a PythonValue
Nominally the second argument will be constructed via the 'unicode' method
provided in this module.
Get attributes from a PythonValue via a PythonValue Nominally the second argument will be constructed via the ' unicode ' method provided in this module .
static VALUE
redrat_getattr(VALUE self, VALUE rTarget, VALUE rPyString)
{
    PyGILState_STATE    gstate;
    PyObject *pTarget;
    PyObject *pAttrName;
    PyObject *pResult = NULL;
    VALUE rExcFromDelegation;
    VALUE rResult;
    if (!(REDRAT_PYTHONVALUE_P(rTarget) && REDRAT_PYTHONVALUE_P(rPyString)))
        rb_raise(rb_eArgError,
                 "redrat_ext: getattr only supports PythonValues");
    gstate = PyGILState_Ensure();
    Data_Get_Struct(rTarget, PyObject, pTarget);
    Data_Get_Struct(rPyString, PyObject, pAttrName);
    pResult = PyObject_GenericGetAttr(pTarget, pAttrName);
    REDRAT_ERRJMP_PYEXC(rExcFromDelegation, pResult);
    rResult = redrat_ruby_handoff(pResult);
    PyGILState_Release(gstate);
    return rResult;
py_rb_error:
    PyGILState_Release(gstate);
    if (rExcFromDelegation != Qnil)
        redrat_rb_exc_raise(rExcFromDelegation,
                            "redrat_ext: Could not delegate to Python");
    Assert(false);
}
static VALUE redrat_getattr ( VALUE self , VALUE rTarget , VALUE rPyString ) { PyGILState_STATE gstate ; PyObject * pTarget ; PyObject * pAttrName ; PyObject * pResult = NULL ; VALUE rExcFromDelegation ; VALUE rResult ; if ( ! ( REDRAT_PYTHONVALUE_P ( rTarget ) && REDRAT_PYTHONVALUE_P ( rPyString ) ) ) rb_raise ( rb_eArgError , " " ) ; gstate = PyGILState_Ensure ( ) ; Data_Get_Struct ( rTarget , PyObject , pTarget ) ; Data_Get_Struct ( rPyString , PyObject , pAttrName ) ; pResult = PyObject_GenericGetAttr ( pTarget , pAttrName ) ; REDRAT_ERRJMP_PYEXC ( rExcFromDelegation , pResult ) ; rResult = redrat_ruby_handoff ( pResult ) ; PyGILState_Release ( gstate ) ; return rResult ; py_rb_error : PyGILState_Release ( gstate ) ; if ( rExcFromDelegation != Qnil ) redrat_rb_exc_raise ( rExcFromDelegation , " " ) ; Assert ( false ) ; }
redrat_getattr - Get attributes from a PythonValue via a PythonValue
 Nominally the second argument will be constructed via the 'unicode' method
 provided in this module.
redrat_getattr - Get attributes from a PythonValue via a PythonValue Nominally the second argument will be constructed via the ' unicode ' method provided in this module .