Ananthakrishnan <ananthakrishnan15.2...@gmail.com> added the comment:

This is my code for math.gcd:

static PyObject *
math_gcd(PyObject *module, PyObject *args, Py_ssize_t n)
{
    PyObject *g = 0, *item, *in;
    
    Py_ssize_t i;
    for (i = 0; i < n; i++) {
        item = args[i];
        in = PyNumber_Index(item);
        if (in == NULL) {
            return NULL;
        }
        g = _PyLong_GCD(g, in);
    }
    Py_DECREF(in);
    return g;
}



This is showing an error:

error: incompatible types when assigning to type ‘PyObject * {aka struct 
_object *}’ from type ‘PyObject {aka struct _object}’
       item = args[i];
           ^^^

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39648>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to