[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

Vajrasky Kok report at bugs.python.org
Thu Jan 23 08:50:30 CET 2014


Vajrasky Kok added the comment:

Here is the patch for floatobject. I did not convert 2 sites. The first is the round method which clinic explicitly does not support. The second one is the new method. This is the snippet of new method:

float_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
    PyObject *x = Py_False; /* Integer zero */
    static char *kwlist[] = {"x", 0};

    if (type != &PyFloat_Type)
        return float_subtype_new(type, args, kwds); /* Wimp out */
    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:float", kwlist, &x))
        return NULL;
    /* If it's a string, but not a string subclass, use
       PyFloat_FromString. */
    if (PyUnicode_CheckExact(x))
        return PyFloat_FromString(x);
....

If I clinic this method, I could not put custom code before parsing arguments code anymore. This could affect the performance or may not be correct at all.

----------
Added file: http://bugs.python.org/file33643/clinic_floatobject.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20185>
_______________________________________


More information about the Python-bugs-list mailing list