Author vajrasky
Recipients larry, nadeem.vawda, serhiy.storchaka, vajrasky
Date 2014-01-22.09:32:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390383151.47.0.638083504181.issue20185@psf.upfronthosting.co.za>
In-reply-to
Content
Here is the patch for listobject. A couple of thoughts:

1. I can not convert this signature:

    if (!PyArg_ParseTuple(args, "O|O&O&:index", &v,
                                _PyEval_SliceIndex, &start,
                                _PyEval_SliceIndex, &stop))
        return NULL;

It's bloody difficult. If I make start (and stop) as PyObject, I get a lot of pointer warning conversion. The closest I can get is making start (and stop) as Py_ssize_t but it changes the behaviour. a.index(0, -4*sys.maxsize, 4*sys.maxsize) will throw OverflowError.

2. for tp_init, it forces me to give wrong return signature.
"__init__([sequence=None])\n"

This is the clinic input:

list.__init__

  self: PyListObject
  [
  sequence: object(c_default="NULL") = None
  ]
  /

Without None, it will be an error in clinic process.

3. The init function returns integer but in error case, it returns NULL which will throws pointer warning conversion.

static int
list___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
    int return_value = -1;
    int group_right_1 = 0;
    PyObject *sequence = NULL;

    if (!_PyArg_NoKeywords("__init__", kwargs))
        goto exit;
    switch (PyTuple_GET_SIZE(args)) {
        case 0:
            break;
        case 1:
            if (!PyArg_ParseTuple(args, "O:__init__", &sequence))
                return NULL;
            group_right_1 = 1;
            break;
....
History
Date User Action Args
2014-01-22 09:32:31vajraskysetrecipients: + vajrasky, larry, nadeem.vawda, serhiy.storchaka
2014-01-22 09:32:31vajraskysetmessageid: <1390383151.47.0.638083504181.issue20185@psf.upfronthosting.co.za>
2014-01-22 09:32:31vajraskylinkissue20185 messages
2014-01-22 09:32:31vajraskycreate