예제 #1
0
static PyObject* value_from_frame_or_namespace(PyObject* _, PyObject* args) {
    char* key;
    PyObject* locals;
    PyObject* globals;
    PyObject* ns;
    PyObject* ret;

    if (!PyArg_ParseTuple(args, "sOOO", &key, &locals, &globals, &ns)) {
        return NULL;
    }

    if ((ret = _frame_lookup(key, locals, globals))) {
        return ret;
    } else {
        return _ns_lookup(key, ns);
    }
}
예제 #2
0
static PyObject* value_from_frame_or_search_list(PyObject* _, PyObject* args) {
    char* key;
    PyObject* locals;
    PyObject* globals;
    PyObject* selfobj;
    PyObject* ns;
    PyObject* ret;

    if (!PyArg_ParseTuple(args, "sOOOO", &key, &locals, &globals, &selfobj, &ns)) {
        return NULL;
    }

    if ((ret = _frame_lookup(key, locals, globals))) {
        return ret;
    } else if ((ret = _self_lookup(key, selfobj))) {
        return ret;
    } else {
        return _ns_lookup(key, ns);
    }
}