[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files
Vajrasky Kok
report at bugs.python.org
Wed Jan 22 10:32:31 CET 2014
Vajrasky Kok added the comment:
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;
....
----------
Added file: http://bugs.python.org/file33612/clinic_listobject.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20185>
_______________________________________
More information about the Python-bugs-list
mailing list