This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Ananthakrishnan
Recipients Ananthakrishnan, BernardoSulzbach, Dennis Sweeney, SilentGhost, mark.dickinson, rhettinger, serhiy.storchaka, steven.daprano, tim.peters
Date 2020-02-21.06:41:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582267300.85.0.976877475485.issue39648@roundup.psfhosted.org>
In-reply-to
Content
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];
           ^^^
History
Date User Action Args
2020-02-21 06:41:40Ananthakrishnansetrecipients: + Ananthakrishnan, tim.peters, rhettinger, mark.dickinson, steven.daprano, SilentGhost, serhiy.storchaka, Dennis Sweeney, BernardoSulzbach
2020-02-21 06:41:40Ananthakrishnansetmessageid: <1582267300.85.0.976877475485.issue39648@roundup.psfhosted.org>
2020-02-21 06:41:40Ananthakrishnanlinkissue39648 messages
2020-02-21 06:41:40Ananthakrishnancreate