コード例 #1
0
ファイル: _thunk.c プロジェクト: pombredanne/lazy_python
static PyObject *
thunk_ipower(PyObject *a, PyObject *b, PyObject *c)
{
    PyObject *val;

    if (PyObject_IsInstance(a, (PyObject*) &thunk_type)) {
        val = _strict_eval_borrowed(a);
        return PyNumber_InPlacePower(val, b, c);
    }
    else {
        val = _strict_eval_borrowed(b);
        return PyNumber_InPlacePower(a, val, c);
    }
}
コード例 #2
0
ファイル: operations.hpp プロジェクト: gitter-badger/Nuitka
NUITKA_MAY_BE_UNUSED static PyObject *POWER_OPERATION2( PyObject *operand1, PyObject *operand2 )
{
    PyObject *result = PyNumber_InPlacePower( operand1, operand2, Py_None );

    if (unlikely( result == NULL ))
    {
        return NULL;
    }

    return result;
}
コード例 #3
0
ファイル: operations.hpp プロジェクト: gitter-badger/Nuitka
NUITKA_MAY_BE_UNUSED static bool POWER_OPERATION_INPLACE( PyObject **operand1, PyObject *operand2 )
{
    PyObject *result = PyNumber_InPlacePower( *operand1, operand2, Py_None );

    if (unlikely( result == NULL ))
    {
        return false;
    }

    if ( result != *operand1 )
    {
        Py_DECREF( *operand1 );
        *operand1 = result;
    }

    return true;
}
コード例 #4
0
static PyObject *Proxy_inplace_power(ProxyObject *self,
        PyObject *other, PyObject *modulo)
{
    PyObject *object = NULL;

    Proxy__ENSURE_WRAPPED_OR_RETURN_NULL(self);
    Proxy__WRAPPED_REPLACE_OR_RETURN_NULL(other);

    object = PyNumber_InPlacePower(self->wrapped, other, modulo);

    if (!object)
        return NULL;

    Py_DECREF(self->wrapped);
    self->wrapped = object;

    Py_INCREF(self);
    return (PyObject *)self;
}
コード例 #5
0
static PyObject *
call_ipow(PyObject *self, PyObject *other)
{
    /* PyNumber_InPlacePower has three args.  How silly. :-) */
    return PyNumber_InPlacePower(self, other, Py_None);
}