Derby #9: Convert 52 sites to Argument Clinic across 11 files #64377
Copy link
Copy link
Closed
Labels
3.8 (EOL)end of lifeend of lifeextension-modulesC modules in the Modules dirC modules in the Modules dirtopic-argument-clinictype-featureA feature request or enhancementA feature request or enhancement
Description
| BPO | 20178 |
|---|---|
| Nosy | @larryhastings, @meadori, @berkerpeksag, @serhiy-storchaka, @erlend-aasland |
| Files |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = 'https://github.com/meadori'
closed_at = None
created_at = <Date 2014-01-08.00:14:38.886>
labels = ['extension-modules', 'type-feature', '3.8', 'expert-argument-clinic']
title = 'Derby #9: Convert 52 sites to Argument Clinic across 11 files'
updated_at = <Date 2021-06-22.22:57:35.751>
user = 'https://github.com/larryhastings'bugs.python.org fields:
activity = <Date 2021-06-22.22:57:35.751>
actor = 'erlendaasland'
assignee = 'meador.inge'
closed = False
closed_date = None
closer = None
components = ['Extension Modules', 'Argument Clinic']
creation = <Date 2014-01-08.00:14:38.886>
creator = 'larry'
dependencies = []
files = ['33438', '33470', '39296']
hgrepos = []
issue_num = 20178
keywords = ['patch']
message_count = 14.0
messages = ['207634', '207740', '208000', '208001', '208130', '208186', '208187', '208381', '208414', '224759', '242607', '242649', '324851', '396373']
nosy_count = 5.0
nosy_names = ['larry', 'meador.inge', 'berker.peksag', 'serhiy.storchaka', 'erlendaasland']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'patch review'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue20178'
versions = ['Python 3.8']Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.8 (EOL)end of lifeend of lifeextension-modulesC modules in the Modules dirC modules in the Modules dirtopic-argument-clinictype-featureA feature request or enhancementA feature request or enhancement
Activity
larryhastings commentedon Jan 8, 2014
This issue is part of the Great Argument Clinic Conversion Derby,
where we're trying to convert as much of Python 3.4 to use
Argument Clinic as we can before Release Candidate 1 on January 19.
This issue asks you to change the following bundle of files:
Modules/_ctypes/_ctypes.c: 8 sites
Modules/_ctypes/_ctypes_test.c: 1 sites
Modules/_ctypes/callproc.c: 14 sites
Modules/_ctypes/stgdict.c: 0 sites
Modules/_curses_panel.c: 3 sites
Modules/_sqlite/cache.c: 1 sites
Modules/_sqlite/connection.c: 12 sites
Modules/_sqlite/cursor.c: 5 sites
Modules/_sqlite/microprotocols.c: 1 sites
Modules/_sqlite/module.c: 6 sites
Modules/_sqlite/row.c: 1 sites
Talk to me (larry) if you only want to attack part of a bundle.
For instructions on how to convert a function to work with Argument
Clinic, read the "howto":
http://docs.python.org/dev/howto/clinic.html
meadori commentedon Jan 9, 2014
I will pick this one up.
meadori commentedon Jan 13, 2014
Larry, the attached patch converts what is convertible of
Modules/_ctypes/_ctypes. Although, I ran into an odd case
with this conversion: the converted functions are each used
in *multiple* PyMethodDef tables. So while clinic can generate
equivalent code, the builtins are not all pinned to one type.
The type I pinned it to is the same type that the methods
are documented against:
http://docs.python.org/2/library/ctypes.html#ctypes.\_CData
Since clinic makes you explicitly specify the fully qualified method
name, I assume sharing like this is not allowed.
Thoughts?
meadori commentedon Jan 13, 2014
None of the sites in Modules/_curses_panel.c look convertible.
meadori commentedon Jan 15, 2014
Attached is a first cut for sqlite3. It is generally OK, but I have the following
nits:
larryhastings commentedon Jan 15, 2014
In the past few days I added "cloning" functions, which lets you reuse the parameters and return converter from an existing function. That might help with Modules/_ctypes/_ctypes.
larryhastings commentedon Jan 15, 2014
All the functions in curses_panel are convertable. The threeMETH_NOARGS functions simply get no arguments. And here's new_panel:
new_panel
window: object(subclass_of='&PyCursesWindow_Type')
/
larryhastings commentedon Jan 18, 2014
Meador: I'm going to change Argument Clinic so you can get the "args" and "kwargs" values passed in to the impl. That's issue bpo-20291; I already added you to it "nosy" list. With that change in you'll be able to convert "sqlite3.connect".
larryhastings commentedon Jan 18, 2014
Larry Hastings added the comment:
I should have a fix in for __init__ and __call__ later today. (Issue bpo-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.
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 bpo-20291.) Again, even
if Argument Clinic doesn't do any parsing, it's still helpful to have it
generate signatures.
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
bpo-20226, which I guess you already noticed.
You can't. How about you use a default of -1 and then:
if (maxrows == -1)
maxrows = self->arraysize
I'd prefer it if you converted them anyway. Converting them means they'll
have signature information which is an unconditional good.
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!
larryhastings commentedon Aug 4, 2014
All the Derby patches should only go into trunk at this point.
serhiy-storchaka commentedon May 5, 2015
bpo-20178-cyptes-01.patch is outdated due to changes in Argument Clinic and ctypes. Here is updated and extended patch.
serhiy-storchaka commentedon May 6, 2015
For Modules/_curses_panel.c there is special issue, bpo-20171, with the patch.
bpo-20178-sqlite-01.patch is applied almost clearly, but due to changes to Argument Clinic it should be updated. Perhaps more functions can be converted (functions that don't use PyArg_Parse* are worth to be converted too).
berkerpeksag commentedon Sep 8, 2018
I'm working on converting Modules/_sqlite/* to Argument Clinic.
erlend-aasland commentedon Jun 22, 2021
FYI, sqlite3 was converted to Argument Clinic in bpo-40956.