[issue20178] Derby #9: Convert 52 sites to Argument Clinic across 11 files

Larry Hastings report at bugs.python.org
Sat Jan 18 20:38:21 CET 2014


Larry Hastings added the comment:

Larry Hastings added the comment:

>  * As is probably expected, __init__ and __call__ procs
> can't be converted.

I should have a fix in for __init__ and __call__ later today.  (Issue #20294.)
For the record, you could convert them, you just had to wrap the parsing function
to deal with the return type difference, and *args / **kwargs might be tricky too.

>     * sqlite3.Connection.{execute, executemany, executescript} don't use
>       PyArg_Parse*.

In the next few days I'm going to add support for "*args" and "**kwargs", and
then you'll be able to convert these functions.  (Issue #20291.)  Again, even
if Argument Clinic doesn't do any parsing, it's still helpful to have it
generate signatures.


>     * The clinic version of 'sqlite3.adapt' has an argument string of "O|OO".
>       The first optional parameter defaults to 'pysqlite_PrepareProtocolType'
>       in C and 'sqlite3.ProtocolType' in Python.  However, I don't know how to
>       represent the Python value because Python default values are 'eval'd by
>       clinic *and* the 'sqlite3' module is not imported for the eval.

You'll be able to do this soon:

parameter: object(c_default='pysqlite_PrepareProtocolType') = ProtocolType

This feature isn't checked in yet, I'm waiting for a review.  It's part of
#20226, which I guess you already noticed.

>  * The clinic version of 'sqlite3.Cursor.fetchmany' has an arguments string
>    of "|i".  The first parameter defaults to
>    '((pysqlite_Cursor *)self)->arraysize' in C and 'self.arraysize' in
>    Python.  I don't know how to express the Python initialization.

You can't.  How about you use a default of -1 and then:

  if (maxrows == -1)
      maxrows = self->arraysize

>  * I didn't convert 'sqlite3.Cursor.setinputsizes' and
>    'sqlite3.Cursor.setoutputsize' because they share a docstring and
>    simple no-op method def.

I'd prefer it if you converted them anyway.  Converting them means they'll
have signature information which is an unconditional good.

>  * I didn't convert 'sqlite.connect' because it would have required
> packaing the arguments back up to pass to 'PyObject_Call'.

Once I add the ability to pass in *args and **kwargs, you'll be able to
convert sqlite.connect.  

I think I responded to all your other comments when I reviewed the patch.

Thanks!

----------

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


More information about the Python-bugs-list mailing list